I made some tests to check this but is quite not expected: http://jsperf.com/value-in-array-or-object
You can run those tests too..
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not faster. It appeared faster in your tests because you were assigning rather than comparing in the tests for 50 and 100 items:
The test with 10 items was correct:
See updated test cases here.