Enable ECMAScript 6 Summary (WinDOS and Linux) in Nodejs _node.js

Source: Internet
Author: User

To enable the ES6 (harmony) version in Nodejs:

Let's go

Linux Enabled
Source: http://h3manth.com/new/blog/2013/es6-on-nodejs/

Node version:v0.11.6

First look at the version of harm;):

 $ node--v8-options | grep harm--harmony_typeof (Enable harmony semantics for typeof) --harmony_scoping (Enable Harmony block scoping)--harmony_modules (Enable Harmony modules (implies block scoping))-- Harmony_symbols (Enable harmony symbols (a.k.a. Private names))--harmony_proxies (Enable Harmony proxies)--harmony_col Lections (Enable harmony collections (sets, maps, and weak maps))--harmony_observation (Enable Harmony object Observatio N (implies Harmony Collections)--harmony_typed_arrays (Enable harmony typed arrays)--harmony_array_buffer (Enable harm ony array buffer)--harmony_generators (Enable harmony Generators)--harmony_iteration (Enable harmony iteration (for-of
 )--harmony_numeric_literals (Enable harmony Numeric literals (0o77, 0B11))--harmony_strings (Enable harmony String) --harmony_arrays (Enable harmony arrays)--harmony (Enable all harmony features (except typeof)) 


Yes, we can use awk to enable all the ES6 new features that need to be used with strict

$ node--use-strict $ (Node--v8-options | grep harm | awk ' {print} ' | xargs) #ES6


Enabled under Windows (Common method)
Source: http://stackoverflow.com/questions/13351965/what-does-node-harmony-do

Node--harmony app.js


Look at an example
Scope

The keyword let lets you limit the scope of a variable to a block of code

' Use strict ';
if (1) {let
  b = 2;
  Console.log (b);  2
}
Console.log (typeof b);//undefined

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.