I have an array with key value pairs.
var array=[
{Key:"Name",Value:"Sam" },
{Key:"Marks",Value:"50"},
{Key:"Subject",Value:"English"},
];
I want to push Value of object whose Key is 'Subject' into a variable. I tried to see how Value can be accessed but failed at the very first step.
How can this be done?
for (var key in array[0])
{
console.log(key[i].Value); //error: Cannot read property 'Value' of undefined
}
How can I push Value of object whose Key is 'Subject' into a variable?