Class
In addition to the already built in types, such as Map
and Function
, you can also define your own types. This is done with the class
-keyword.
Class properties
Instance of a class
To be able to use the class as a value, you need to create a class-instance with the keyword new
.
This code together with the class definition above will print
Multiple instances
You can have multiple instances of the same class if you want, and each class will get it’s own copy of all methods and values
The result would be: