json Data:
var fruit = [{"apple":1000},
{"mango":100},{"orange":200}];
var user_input = "apple"; //this will change dynamically.
for(var key in fruit) {
var val = fruit[key];
console.log(val[user_input]);
}
output: undefined
i want to access the data using user input