简体   繁体   中英

Ecmascript 6 support on Node.js

I've been working with KoaJS for a while, and we can easily use the 'let' keyword and the generators when using the --harmony flag but I couldn't find how much support for does the node v0.11.x provides while using the same.

I tried using the default value argument initialization but couldn't succeed.

Is there any source available which can list the no of features of ECS 6 supported in node v0.11.x using the harmony flag? Or if there is any npm module available for node that might allow me to use the same?

Thanks in advance.

With regards to your second question, yes, there is es6-module-loader . For a long list of transpilers, shims, and other tools for using full ES6 features now, see addyosmani's ECMAScript 6 Tools page .

As for native ES6 support in node.js, V8 officially implements "ECMAScript" but AFAIK the V8 project doesn't release a spec of their implementation. However there are some sources of useful information out there. Here's a brief overview of ES6 in node.js v0.11.6 .

You may want to determine the version of V8 that your version of node.js uses . See the node.js blog for recent changelog info. It can also be useful to find the version of V8 used in a given Chromium release . The Chrome release notes can be found here . Keep in mind that different flags can be set for the same version of V8. Chromium and node.js both have ways to set flags in V8 related to ES6 support .

Here are two tables that list ES(6) feature support across implementations:

This MDN page lists a set of reference articles for ES6 language features. At the bottom of each one you can see the status of Chrome support for that feature (and using V8 versions determine the support in node.js).

Finally, the V8 issue tracker provides a list of issues related to ES6 features, many of which have been implemented and their issues closed.

您可以在Node.js中使用~96%的ES6功能。您可以在http://node.green/上查看对所有版本的支持。

This does not concern node 0.11, but in the current 5.8.0, you can use --harmony_default_parameter .

It it scheduled to be included by default in v6.0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM