192
rated 0 times
[
195]
[
3]
/ answers: 1 / hits: 28783
/ 8 Years ago, wed, july 20, 2016, 12:00:00
I have this array of objects:
var frequencies = [{id:124,name:'qqq'},
{id:589,name:'www'},
{id:45,name:'eee'},
{id:567,name:'rrr'}];
I need to get an object from the array above by the id
value.
For example I need to get the object with id = 45.
I tried this:
var t = frequencies.map(function (obj) { return obj.id==45; });
But I didn't get the desired object.
How can I implement it using JavaScript prototype functions?
More From » javascript