javscript smart array loop, need some help here
- by Totty
var _test1 = [];
_test1[88] = 'sex';
_test1[1999990] = 'hey';
for(i = 0, length = _test1.length; i < length; i++){
if(_test1[i] == 'hey'){
alert(_test1.length);
}
}
this takes a lot of time, and there are only 2 values.
Is there any way to be faster?
Or to use another system that index objects by a number and then loop them fast?
thanks