Skip to content

Instantly share code, notes, and snippets.

@JTLR
Created April 23, 2017 21:56
Show Gist options
  • Save JTLR/09835733ca80aa26fce04301b0d97e1b to your computer and use it in GitHub Desktop.
Save JTLR/09835733ca80aa26fce04301b0d97e1b to your computer and use it in GitHub Desktop.
JavaScript function to check if array contains object
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