HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Create a Car class, and then an object (myCar) based on the Car class
A class
is a type of object template.
The class
statement initiates a JavaScript class.
Properties and methods are assigned in the constructor()
method.
The constructor()
method is called each time a class object is initialized.
The syntax in a class must be written in "strict mode".
Unlike functions, class declarations are not hoisted (you must declare a class before you can use it).
JavaScript Tutorial: JavaScript Classes
JavaScript Tutorial: JavaScript ES6 (EcmaScript 2015)
JavaScript Tutorial: JavaScript this
JavaScript Tutorial: JavaScript Strict Mode
class
is an ECMAScript6 (ES6) feature.
ES6 (JavaScript 2015) is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
class
is not supported in Internet Explorer 11 (or earlier).