javascript filter array of objects

Posted by user441521 on Stack Overflow See other posts from Stack Overflow or by user441521
Published on 2012-11-27T23:02:32Z Indexed on 2012/11/27 23:03 UTC
Read the original article Hit count: 319

Filed under:
|
|

I have an array of objects and I'm wondering the best way to search it. Given the below example how can I search for name = "Joe" and age < 30? Is there anything jQuery can help with or do I have to brute force this search myself?

var names = new Array();
var object = { name : "Joe", age:20, email: "[email protected]"};

names.push(object);
object = { name : "Mike", age:50, email: "[email protected]"};
names.push(object);
object = { name : "Joe", age:45, email: "[email protected]"};
names.push(object);

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery