Hello ! The instruction says , " Using dot and bracket notation, set the variable secondTree to the second item in the trees list from the myPlants object."
My question is why it is describing ‘myPlants’ variable as an object ? Isn’t it a list as it uses third bracket first ? Similarly shouldn’t ‘trees’ described as a list be an object in accordance with what we have learned so far ? Can someone clarify, kindly ?
Technically, myPlants is an array of objects.
The array myPlants contains a tree object, which contains a property called list, which is in array form.
(A Javascript array is similar, but not identical, to a Python list, so the terms cannot be used interchangeably).
Slightly confusing terminology perhaps, but I hope that makes sense!
Sorry … I wanted to say array . But called it as list. It was a mistake. But my question remains the same. Please, read it here now. I have corrected it -
Hello ! The instruction in the lesson says , " Using dot and bracket notation, set the variable secondTree to the second item in the trees list from the myPlants object."
My question is why it is describing ‘myPlants’ variable as an OBJECT ? Isn’t it an ARRAY as it uses Third Bracket First ? Has there been a mistake ? If so then they can correct it.
Declare JavaScript data type variables In computer science, data is anything that is meaningful to the computer. JavaScript provides eight different data types which are undefined, null, boolean, string, symbol, bigint, number, and object.
So of the eight data types, only object can be used when describing an array.