Javascript get value from an object inside an array

You are trying to get the value from the first element of the array. ie, data[0]. This will work:

console.log(data[0].value);

If you have multiple elements in the array, use JavaScript map function or some other function like forEach to iterate through the arrays.

data.map(x => console.log(x.value));

data.forEach(x => console.log(x.value));

You can use the map property of the array. Never try to get the value by hardcoding the index value, as mentioned in the above answers, Which might get you in trouble. For your case the below code will works.

data.map(x => x.value)