avaScript Object Constructors
avaScript Object Constructors
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;
Note:
The value of this will become the new object when a new object is created.
See Also:
Example
A value given to a property will be a default value for all objects created by
the constructor:
Example
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eyecolor;
this.nationality = "English";
myFather.nationality = "English";
Note:
The new property will be added to myFather. Not to any other Person
Objects.