Statements

Class declaration

Try the free JavaScript compiler

Creates a class binding with lexical initialization rules and a constructor value. Ordinary public instance methods reside on its prototype; class code is strict.

Formal Syntax & Structure

javascript syntaxjavascript
class Name { constructor() {} method() {} }

Working Example

Example Snippetjavascript
class Box{read(){return 3;}}console.log(new Box().read());
JavaScript Reference