class

class – Declares a class.

Description

class name [class extends]

Parameters

Name Description Type Default Optional
extends class Yes

Changelog

Version Description
ES 6 Introduced.

Examples

Example #1 – class example
'use strict'; class a { constructor () { } } console.log(typeof a); // function var b = new a(); console.log(b); // a {} console.log(typeof b); // object
Example #2 – class example
'use strict'; class MyClass { myMethod () { return 'Hello World'; } } var myClass = new MyClass(); console.log(myClass.myMethod());

External references