Search code examples
javascriptclass

How is the `class` keyword used in JavaScript 2.0 and how does it differ from JavaScript 1.x?


According to this article it should be a JavaScript 2.0 way to define a class. However, I never saw that in practice. Thus the question. How to use the class keyword and what is the difference between JavaScript 1.x way of doing things?


Solution

  • The reason you never saw the class keyword used in practice is that all the current implementations of JavaScript are 1.x.

    JavaScript 2.0 was merged into ECMAScript 4 which was rather unpopular and so never made it into the real world.

    So to answer your question, how do you use the class keyword? You can't.