roberto benites2,897 Points
Can someone explain the "bracket" notation that s used to pass the strings? I'm not sure i fully understand how its used
in the video and code he uses the following: element[property] = value;
How are the brackets being used here? I thought brackets were used to hold arrays of objects.
Steven Parker153,114 Points
Brackets are used to index arrays. But they're also one of two ways to access object properties
The more common property access method is dot notation. And example would be "
myobject.propname". But the same thing can be accessed with bracket notation: "`myobject['propname']". And in the example shown above, "property" is a string variable containing the property name to be accessed (since it's not a quoted string literal).