Skip to content

Instantly share code, notes, and snippets.

@chrisjhoughton
Created March 13, 2014 13:45
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 chrisjhoughton/9528773 to your computer and use it in GitHub Desktop.
Save chrisjhoughton/9528773 to your computer and use it in GitHub Desktop.
Check if a value exists in an array.
var contains = function(arr, value) {
var i = arr.length;
while (i--) {
if (arr[i] === value) {
return true;
}
}
return false;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment