Example 1:
["member1", "member2",...,..., "member100000"]
Example 2:
{
"member1": true,
"member2": true,
"...",
"member100000": true
}
I store the elements in an array on each piece of content, as in Example 1, but by doing this, I would have to iterate through 49999 elements in my array to find the 50000 element, so I just thought to check that a specific key is defined in the object javascript would be the best approach here, although I don't need to store the value, but just check if the key is undefined or not?
I need to check for example. "member50000" exists as a value inside my array - or as a key inside my object.
I did some benchmarking tests, but I'm not sure if I came to the right conclusion, or if I am doing something wrong in comparison: http://jsperf.com/lolda123
, / , (true), if(obj["member50000"]) ? ? , , , , , , , .
, - , , , , , ?