Javascript array search -
Javascript array search -
whats best way search javascript array entry?? items strings.
is using lastindexof? so:
var list= []; list.push("one"); list.push("two"); list.push("three"); if(list.lastindexof(somestring) != -1) { alert("this nowadays in list"); return; }
is using lastindexof?
yes. however, i'd utilize simpler indexof()
if don't need explicitly search backwards (which don't if test "does not contain"). notice these methods standardized in es5 , need shimmed in old browsers not back upwards them natively.
javascript
Comments
Post a Comment