Is there a way to query JavaScript objects with JQuery selectors?
For example, consider an array:
var users = [{id: 0, username: 'Alice'}, {id: 1, username: 'Bob'}, {id: 2, username: 'Cindy'}];
, then the following works fine:
$(users).each(function (index, user) { ... });
I need to be able do something like this:
$(users).find('[username="Bob"]').each(function(index, user){ ... });
, but I could figure out a proper selector string value. Any ideas?
Array.prototype.filter()