Classes
Classes are templates for creating an object. It encapsulates data with code to work on with data. The keyword class
is used to create a class. And a specific method called constructor
is used for creating and initializing an object created with a class
. An example of car class is shown below.
In the class body, methods or constructors are defined and executed in strict mode
. Syntax not adhering to the strict mode results in error.
Last updated
Was this helpful?