JavaScript Object Properties

The properties of an object are accessed using the dot notation. The syntax for accessing a property or method of an object is as follows:

objectName['property']
//or
objectName.property

Both approaches allow you to access object properties. For example, the following code prints the value of the name property of the person object:


		

Task

Run the above code and experiment with the code to get used to it.

ADVERTISEMENT
ADVERTISEMENT