JavaScript Object Methods

A method is a function that is associated with an object. Methods are used to perform actions on the object.

The syntax for a JavaScript method is as follows:

objectName.method()

The methods of an object are accessed using the dot notation.

The console.log() method is a JavaScript object method that is used to output messages to the browser’s console. Here is an example of a JavaScript object method:


				

Task

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

ADVERTISEMENT
ADVERTISEMENT