在nodejs中启用es6(和谐)版本:
开始吧,,
Linux下启用
来源:http://h3manth.com/new/blog/2013/es6-on-nodejs/
节点版本:V0.11.6
先来看一看版本危害;):
$ node -v8-options | Grep Harm -Harmony_Typeof(启用类型的和谐语义) - Harmony_scoping(启用Harmony_Modules(启用和谐模块)(启用Harmony_Modules(启用块范围范围)) --harmony_collections (enable harmony collections (sets, maps, and weak maps)) --harmony_observation (enable harmony object observation (implies harmony collections) --harmony_typed_arrays (enable harmony typed arrays) --harmony_array_buffer (enable harmony array buffer) --harmony_generators (enable harmony generators) --harmony_iteration (启用和谐迭代(for-of)) - harmony_numeric_literals(启用和谐数字文字(0o77,0b11)) - harmony_strings(启用和谐字符串) - harmony_arrays(启用Harmony_arrays(启用和谐阵列) - Harmony(Harmony)
不错,a awk来启用所有的eS6新特性
$ node - use-strict $(node -v8-options | grep harm | awk'{print $ 1}'| xargs)#es6(窗口下启用(通用方法)
来源:http://stackoverflow.com/questions/13351965/what does-node-node-harmony-do
节点 - Harmony App.js
看一个例子
作用域
关键字让可以让我们将变量的作用范围限定在一个代码块中
“使用严格”;如果(1){让B = 2; console.log(b); //2} console.log(typeof b); //不明确的