I’m new to JS and am trying to get a value from inside of this array.
assetList =
[
{data:
[{track: 1, status: 'ready', id: 1111111}, {track: 2, status: 'idle', id: 2222222}]
}
];
In the console I enter:
assetList[0].data[0].id
and I get back the value 1111111 as I expect to, however when I try to pass the value into a variable in my actual JS script as per below:
var assetListData = assetList[0].data[0].id;
I get an error back, Uncaught TypeError: Cannot read properties of undefined (reading ‘data’)
What am I doing wrong here? Thanks for your help!