javscript smart array loop, need some help here

Posted by Totty on Stack Overflow See other posts from Stack Overflow or by Totty
Published on 2010-04-25T19:54:09Z Indexed on 2010/04/25 20:03 UTC
Read the original article Hit count: 340

Filed under:
|
    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

© Stack Overflow or respective owner

Related posts about javscript

Related posts about loop