Created
September 14, 2013 07:10
-
-
Save callblueday/6559548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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