- [Instructor] Classes were introduced with ES6
to have a better syntax for creating prototypes.
We could create these types of objects with
prototypes in the past however the syntax was to verbals.
Therefore the new classes were introduced with ES6.
As a result the new class simply inherits
what prototypes are and its methods.
It is just easier to the fine and use.
Also if any parent prototypes or classes change
all its children inherits all the changes.
Even after an instance of a class has been created.
For example, if we create a class called car
and then create an instance called SUV,
and then changed the main class,
with a seat property.
Then its children will inherit
this new property automatically.
Whether we want it or not.
Classes contrary to most of its declarations
aren't hoisted to the top.
Therefore classes need to be declared first
if we need to use it.
We'll explore hoisting related to classes
a little bit later in this course.
But as a general rule if hoisting
is a bit confusing to you,
try as much as possible to declare classes,
objects, and variables before they are used.
Also there are two ways to define a class.
Class declaration and class expression.
This is the way we define a class declaration.
I will explore more on how to declare classes
this way in future videos.
This is the way we define a class expression,
but more often than not you'll see classes
define what the class declaration approach.
And in this course we'll use class declaration
for all the examples.
Finally, when you define a class
you can add properties as well as functions
or called methods in the class.
I will explore this when we work with them.