I created this nested Array as practice work. In the second object of the nestedArr(which is the first in array understanding), I used space in between the property name ‘items list’ to store the data. I have tried to access data from the items lists array but, I keep having problem. can someone please help out with a hint.
const nestedArr =[
{
description: "Items",
names: [
"Pen",
"Papers",
"ink",
"books"
]
},
{
type: "Material",
"items list": [
"block",
"water",
"irons",
"cements"
]
}
];
const check = nestedArr[0].names[0]; //pen
const check2 nestedArr[1].["items list"][0]; // block
//Second Example
const nestAarray =[
{
type: "Home Office",
detail: [
"Location",
"Address",
"Postal Code",
"Tel#"
},
{
practice: "Make Perfect",
failure: [
"Lesson",
"Teacher",
"Master",
"Print",
"Success"
]
}
];
const check3 = nestArray[1].failure[2]; // Master
const check4 = nestArray[0].detail[0]; // Location
/* I have practice more and more with the second example. It's not a problem for me */
const nestedArr =[
{
description: “Items”,
names: [
“Pen”,
“Papers”,
“ink”,
“books”
]
},
{
type: “Material”,
“items list”: [
“block”,
“water”,
“irons”,
“cements”
]
}
];
const check = nestedArr[0].names[0]; //pen
const check2 nestedArr[1].[“items list”][0]; // block