问题:
The function I am using now to check this is the following:我现在用来检查的功能如下:
function inArray(needle,haystack)
{
var count=haystack.length;
for(var i=0;i<count;i++)
{
if(haystack[i]===needle){return true;}
}
return false;
}
It works.有用。 What I'm looking for is whether there is a better way of doing this.我正在寻找的是是否有更好的方法来做到这一点。
解决方案:
参考一: https://en.stackoom.com/question/UxPg参考二: https://stackoom.com/question/UxPg