Methods
A method is a function defined inside a class. It can read and change the object data using this.
Methods let an object act on itself, like a bank account depositing money into its own balance.
Inside a method, this points to the instance the method was called on.
Try it yourself
Loading editor…