Skip to content

Instantly share code, notes, and snippets.

@callblueday
Created September 14, 2013 07:10
Show Gist options
  • Save callblueday/6559548 to your computer and use it in GitHub Desktop.
Save callblueday/6559548 to your computer and use it in GitHub Desktop.
/**
* Check whether an item is in an array.
* @param {Obj} item
* @param {Array} array
* @return {Boolean}
*/
contains = function(item, array) {
for(var i in array) {
if(array[i] === item) {
return true;
}
}
return false;
}
/**
* Remove an item in an array.
* @param {Obj} item
* @param {Array} array
*/
remove = function(item, array) {
for(var i in array) {
if(array[i] === item) {
array.splice(i, 1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment