Does the js node support ECMAScript 6

Which version of Javascript is supported in node.js?


I start with Node.js and have trouble figuring out which version of JavaScript is supported by Node, which makes it difficult to figure out what features I can use. I know this.

  • Node uses V8
  • V8 implements ECMAScript according to ECMA-262, 3rd edition
  • ECMA-262 3rd edition is JavaScript 1.5

With that in mind, I would assume I can use JavaScript 1.5 compliant code in the node. However, it turns out that I can use this among other things, although according to the MDC it is only available in Javascript 1.6 - ECMA-262, 5th edition.

Where am i going wrong? Is there a document somewhere that lists the language features available?




Reply:


This matrix (V8 follows the WebKit column pretty closely) seems to ask "What functions can I use?" Pretty good answer. However, I can't get a canonical answer to "Which version of Javascript is supported?" Find. As far as I can tell, the best answer is: ECMA-262 3rd Edition is supported, but many features of the 5th Edition are also supported.

There is a good explanation for why V8 obeys the WebKit and JavaScriptCore functions in this thread.



The Node Javascript version depends on which version of v8 Node is using. Node version 0.5.1 (July 14, 2011) and higher uses version 8.4.4.10 or higher and is the 5th edition of ECMA-262 instead of the 3rd edition. The 5th edition corresponds to Javascript 1.8.5. See reasons below.

Between May 21, 2011 and June 15, 2011, the v8 website no longer listed v8 as an implementation of the 3rd edition of ECMA-262 and displayed the 5th edition. http://web.archive.org/web/20110521053630/http://code.google.com/p/v8/ http://web.archive.org/web/20110615102350/http://code.google. com / p / v8 /

According to the v8 changelog, v8 was changed to version 3.4.4 on June 15, 2011. So this version and higher is the 5th edition.

According to the node changelog, v8 was 3.4.10 in node version 0.5.1, July 14, 2011, so this version and higher is the 5th edition of ECMA-26. However, this does not mean that v8 versions prior to 3.4.10 were only the 3rd edition, as there may have been a steady transition from the 3rd to the 5th version in many v8 versions.




At some point node.green was created to track JavaScript functionality support for different Node versions.


It seems like we've been reduced to two strategies to find out which version of the Javascript node to use:

Strategy 1: Trust what is in a document somewhere, which in many cases is wrong. I did not find the table showing the key-value pairs, which version of the node supports which version of ECMAScript.

Strategy 2: Guess and Check.

Find a feature quoted by ES6 and "see if it fails".

I suppose the "Babel" here is a reference to the Tanakh. What features does our version of Node support? Well I don't know, you have to test it manually. This is going to be a huge mess. And worse, it seems to be on purpose.

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.