Objects and Classes
To create a new instance of an object new operator.
Every action declared in the class gets executed at the time of instantiation which can act like the constructor, used to set the object’s properties or to call methods to prepare the object for use.
1 2 3 4 5 6
1 2 3 4 5
Private and Public
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Literal version fo creating Objects and defining Methods and Properties
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
For a literally notated object, you simply use it by referencing its variable name,whereas with constructor functions you need to instantiate (create a new instance of) the object first.