JavaScript equivalent of PHP's in_array() – Stack Overflow

[code]
function inArray(needle, haystack) {
var length = haystack.length;
for(var i = 0; i < length; i++) {
if(haystack[i] == needle) return true;
}
return false;
}
[/code]
via JavaScript equivalent of PHP’s in_array() – Stack Overflow.

Post a comment

Your email address will not be published. Required fields are marked *