Skip to content

Instantly share code, notes, and snippets.

@irazasyed
Created December 8, 2012 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irazasyed/4241706 to your computer and use it in GitHub Desktop.
Save irazasyed/4241706 to your computer and use it in GitHub Desktop.
JavaScript: Function - inArray Snippet.
function inArray(needle, haystack) {
var length = haystack.length;
for(var i = 0; i < length; i++) {
if(haystack[i] == needle) return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment