is there any way to make my jquery search better ?

Posted by From.ME.to.YOU on Stack Overflow See other posts from Stack Overflow or by From.ME.to.YOU
Published on 2010-09-07T08:40:02Z Indexed on 2010/12/24 22:54 UTC
Read the original article Hit count: 110

Filed under:
|
|
|

Hello

var myarr= Array('test1','test2','test3');

var searchTerm = "test";
var rSearchTerm = new RegExp( searchTerm,'i');

$.each(myarr, function(i) {
        if (myarr[i].match(rSearchTerm)) {
            //item found
        }

    });?

guys is there any way to make my search algorithm better ? "myarr" will be a big array so i want to make sure that i'm using the best way to search in it

thanks alot

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery