Created
April 23, 2017 21:56
-
-
Save JTLR/09835733ca80aa26fce04301b0d97e1b to your computer and use it in GitHub Desktop.
JavaScript function to check if array contains object
This file contains hidden or 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
function containsObject(obj, list) { | |
for (var i = 0; i < list.length; i++) { | |
if (list[i] === obj) { | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment