Skip to content
6 changes: 5 additions & 1 deletion en/classes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ description: Classes are templates for creating an object. It encapsulates data
# Chapter 15
# Classes

Classes are templates for creating an object. It encapsulates data with code to work on with data. The keyword `class` is used to create a class. And a specific method called `constructor` is used for creating and initializing an object created with a `class`. An example of car class is shown below.
Classes are templates for creating an object. It encapsulates data with code to work on with data. For example if we want to make a family tree of birds, we can make a bird class and every bird object we make will have the methods and data from the bird class.

The keyword `class` is used to create a class. And a specific method called `constructor` is used for creating and initializing an object created with a `class`. An example of car class is shown below.

```javascript
class Car {
Expand All @@ -31,3 +33,5 @@ Class must be defined before its usage.
{% endhint %}

In the class body, methods or constructors are defined and executed in `strict mode`. Syntax not adhering to the strict mode results in error. 

Every time we create an object from a class we’re creating an **instance** of that class, for example the `myCar` variable above us with the `new` keyword is an instance. Instances are *independant* meaning it doesn’t affect any other instance. This is why classes are thought to be templates for objects. Since once you make that instance object it'll have the same methods as the original class.
6 changes: 5 additions & 1 deletion en/classes/inheritance.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@ console.log(myCar.show()); // I have a Camry, it is a Toyota.
The prototype of the parent class must be an `Object` or `null`. 
{% endhint %}

The `super` method is used inside a constructor and refers to the parent class. With this, one can access the parent class properties and methods.
The `super` method is used inside a constructor and refers to the parent class. With this, one can access the parent class properties and methods. In the example above we use `super(brand)` in the Model subclass so it can get that `Car` superclasses properties.

{% hint style="info" %}
Super classes are the main classes used while subclasses are classes that are extended from superclasses.
{% endhint %}

7 changes: 7 additions & 0 deletions en/functions/set-interval.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
---
chapter: 8
pageNumber: 55
Title: Set Interval
---


# Set Interval
The set Interval method is a method used to call a function and add a delay time to it, in milliseconds, before the function will run again. For example, if you're making a function that generates a random color, you can use `setInterval()` to say how long the computer has to wait before the function runs again and generates another color. This is useful in making functions repeat.

Expand Down
6 changes: 6 additions & 0 deletions en/functions/set-timeout.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
chapter: 8
pageNumber: 56
Title: Set Timeout
---

# Set Timeout
The set timeout global method is used to add a timer (in milliseconds) before a function is ran.

Expand Down