Here is an example of an items array:
this.itemList = [
{ id: 1, name: 'a', address: 'as dasf a' },
{ id: 2, name: 'b', address: 'as dasf a' },
{ id: 3, name: 'c', address: 'as dasf a' }
];
And here is the headers array:
this.headers = [
{ name: 'id', show: true },
{ name: 'name', show: true },
{ name: 'address', show: false }
];
When attempting to access values from the arrays:
let obj = this.headers[0].name; // this equals 'id'
console.log(this.itemList[0].id) // this shows as 1
However, when trying to do:
console.log(this.itemList[0].obj) // it returns undefined, why?
Is there a way to retrieve that value? Thanks