Let's say I have an array of objects that looks like this:
var obj1 = [{
fullName ='Jon Doe',
Name ='Jon',
age ='17',
},
{
fullName ='Bob Smith',
Name ='Bob',
age ='34',
}
]
If I have a var CustomerName = 'Jon'
, how can I possibly retrieve the age
for Jon
var cName = obj1.filter(function(item)){
return item['age'] //?? Where item['name'] == customerName
}
I am a little lost, am i on the right path? THanks.