JavaScript Internals (521 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)
What are the different ways to access object properties
There are 3 possible ways for accessing the property of an object.
- Dot notation: It uses dot for accessing the properties
javascript
objectName.property;
- Square brackets notation: It uses square brackets for property access
javascript
objectName["property"];
- Expression notation: It uses expression in the square brackets
javascript
objectName[expression];