Constructor
The constructor is a special method that runs automatically when you create an instance.
Use it to set up instance properties with this, so every object gets its own values.
- The constructor receives arguments from new
- this refers to the object being created
- You store values as this.property
Try it yourself
Loading editor…