KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm just getting started with Javascript and using the Underscore library. I see they have all sorts of utility function, like _.contains. Is there a way to make this work on objects? var indexes = [ {'id': 1, 'name': 'jake' }, {'id':4, 'name': 'jenny'}, {'id': 9, 'name': 'nick'}, {'id': 1, 'name': 'jake' }, {'id':4, 'name': 'jenny'} ]; if (_.contains(indexes, {'id':1, 'name': 'jake'})) { console.log("contains"); } Most of the examples they show have simple arrays with strings or numbers in them. I was wondering what I can do to use their utility functions like _.contains for objects. Thanks.
Tags (comma-separated)
Save Edits
Cancel