I have an array with nested objects that looks like this. How can I loop through the array and retrieve all the values of the "name" key?
Even though I've tried, I haven't been able to get the expected result.
dangle= [[{name:"jack",age:"20"}],
[{name:"ram",age:"25"}],
[{name:"vishy",age:"45"}]]
My desired output is "jack", "ram", "vishy". However, I'm currently getting the values from the first index like "jack", "20". Below is the code I've attempted so far. Any suggestions on how to achieve the correct output would be greatly appreciated. Thank you!
Here is my current code:
for(i=0;i<dangle.length;i++)
{
alert(dangle[i]);
}