This is the problem
This is the script
var data = [];
axios.get('https://jsonplaceholder.typicode.com/posts')
.then(function (response) {
data.push(response.data['0'])
})
.catch(function (error) {
console.log(error);
});
console.log(data);
console.log(data['0'].body); //this is where I get the error
As you can see in the picture it should be correct but why I cannot read the property ?