The easiest way I could think of is a for loop:
var arr=[["hey","oh"],["scar","tissue"],["other","side"]];
var query="scar";
for(var z=0;z<arr.length;z++){
if(arr[z].indexOf(query) !== -1){
//Found
break;
}
}
在二维数组中,有没有其他的方法来搜索一个字符串?
$(arr).each(function(){if(this.indexOf(query)!=-1){/*it is*/}})
- JCOC611