I am trying to access key values, but it keeps saying the it is undefined
.
I am trying to interact with this API that initially returns this:
[ {
version: [ '2.11.0' ],
timestamp: [ '2020-02-27T22:05:45.407Z' ],
searchResult: [ [Object] ],
paginationOutput: [ [Object] ]
} ]
To access searchResult
, I use the following:
console.log(data[0].searchResult[0]);
That prints out the following object:
{[
{ itemId: [Array],
title: [Array],
},
{ itemId: [Array],
title: [Array],
},
{ itemId: [Array],
title: [Array],
}
]}
However, when I try to access itemId
array by its index as in the following, I keep getting undefined
errors.
let result = data[0].searchResult[0] ;
console.log(result[0]);
Am I missing something?