Why is 'class' a reserved word in JavaScript?


The following are the future reserved words, which include ‘class’. These words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions.

class enum extends super
const export Import

The above is defined in the ECMAScript specification.
In ECMAScript 6 Language Specification it is used. The class declaration creates a class −

class name [extends] {
   // body of class
}


Updated on: 13-Jun-2020

412 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements