If I understood your requirement correctly, you can just use bracket notation like obj['a'].name
var obj = {
a: {
"name": "Emma"
},
b: {
"name": "Harry"
},
c: {
"name": "Jonny"
}
};
var ary = ['a', 'b', 'c']
for (var i = 0; i < ary.length; i++) {
console.log(obj[ary[i]].name)
}
Here you pass the property key as a string to the bracket notation and it will return the value
solved i want to remove double quotes from a string without replace function