I'm trying to get the Object ID to store in the DB for an array of object. Any ideas?
//Input
var data = [{
id: 1,
name: 'a'
},
{
id: 2,
name: 'b'
}
];
This is the Object which I'm trying to get the value of, now what I'm trying to achieve is from name I'm trying to get the id value.
Expected Output
if the result is 'a' then I should get the value '1',
if the result is 'b' then I should get the value '2'
Anyone has any ideas to work on this.. Kindly help me guys