I'm trying to return only the first object's (that) string from an array. In my example when I loop it will return only the string from the third option.
I'd like for it to return only the second option e.g. the first object named that.
I thought it would work like this:
data[i].that[0]
But it will return only the first letter.
var data = [{
"this":"first",
"that":"second",
"that":"third",
},{
"this":"first",
"that":"second",
"that":"third",
}]
data.forEach(function (value, i) {
console.log(data[i].that)
});
Current:
third
third
Expected:
second
second