var people = [
{firstName : \"Thein\", city : \"ny\", qty : 5},
{firstName : \"Michael\", city : \"ny\", qty : 3},
{firstName : \"Bloom\", city : \"nj\", qty
My understanding is the author of the question wants to take an array of objects with many properties and strip each object down to a small list of properties.
There are myriad ways of doing so with _ , but I like this way best. Pass in an empty result object which will be "this" inside the function. Iterate with _each , and _pick the fields you want:
var myObjects = [
{ "first" : "eric",
"last" : "gumbo",
"code" : "x482"
},
{ "first" : "john",
"last" : "dinkman",
"code" : "y9283"
}
];
var result = [];
_.each( myObjects, function(itm) { this.push(_.pick(itm,"first","code")) }, result );
console.log(result);