Brian
Brian

Reputation: 1388

Since when does Node.js offer ES6 classes?

EcmaScript 6 has been published in 2015. In which version were ES6 classes introduced in Node.js? I couldn't find the related github commit.

I'd like to know which was the first Node.js version allowing to use the class keyword as syntactical sugar for prototypes.

Upvotes: 5

Views: 1424

Answers (2)

kungfooman
kungfooman

Reputation: 4892

This is the last release I found which you can use for backwards compatibility testing: https://nodejs.org/download/release/v0.12.18/

> class Test {}
SyntaxError: Unexpected reserved word
    at Object.exports.createScript (vm.js:44:10)
    at REPLServer.defaultEval (repl.js:117:23)
    at bound (domain.js:291:14)
    at REPLServer.runBound [as eval] (domain.js:304:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:214:10)
    at REPLServer.Interface._line (readline.js:553:8)
    at REPLServer.Interface._ttyWrite (readline.js:830:14)
    at ReadStream.onkeypress (readline.js:109:10)

Upvotes: 0

Robsonsjre
Robsonsjre

Reputation: 1606

Node v4.3.2

Was the first version to accept Class method according to http://node.green/

Upvotes: 3

Related Questions