I do have a collection and i need to go through the collection, and alter the data if necessary and push to an array.
{
"Beatles": [
{"name":"Album 1", "rate":"70"},
{"name":"Album 2", "rate":"75"},
{"name":"Album 3", "rate":"82"},
{"name":"Album 4", "rate":"60"}
],
"Purple" :[
{"name":"Album 1", "rate":"30"},
{"name":"Album 2", "rate":"90"},
{"name":"Album 3", "rate":"23"},
{"name":"Album 4", "rate":"14"}
]
}
// I want to go through the collection and save only the rates of Beatles album to an array, so it will look like this
myBeattlesarray = [70,75,82,60];
what is the best way to achieve this. thanks
You can use the Underscore
pluckto get one field from the collection:Fiddle: http://jsfiddle.net/k5AVE/