//三个参数,在array中查找needle,bool为布尔量,如果为true则返回needle在array中的位置
function
inArray2(needle,array,bool){
if(typeof
needle=="string"||typeof needle=="number"){
var
len=array.length;
for(var
i=0;i<len;i++){
if(needle===array[i]){
if(bool){
return i;
}
return true;
}
}
return false;
}
}
原文:http://www.cnblogs.com/hucaihao/p/3514169.html