class / constructor
Defines your own type (class).
Syntax
class Name { Name(p) { this.field = p; } }Description
class creates a class, constructor (method with the same name as the class) sets up object creation. Objects are instantiated with new.
Example
Loading editor…
Expected output
Tabby: meow
When to use?
Object-oriented design.