[Solved] What does [ ] mean in JS?


[] is used in arrays to specify the index we need to access, when we say:

someArray[0] we are getting the value from array’s first index and in your case it is

specifying the index via variable which is coming from the loop and in second it is

specifying object’s property to get the property value from that index which is passed in 1st []:

dateList[i]["name"]

in this case it will return you the ith index element of array’s name property value.

if you say dateList[0]["name"] it will reutrn “Mike Jenson” because it is the value

of first array object’s name property value.

An alterantive is dateList[0].name this will also return the same result.

2

solved What does [ ] mean in JS?