国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

在NodeJS中啟用ECMAScript 6小結(windos以及Linux)

2019-11-20 14:21:20
字體:
來源:轉載
供稿:網友

在NodeJS中啟用ES6 (harmony) 版本:

開始吧,

Linux下啟用
來源: http://h3manth.com/new/blog/2013/es6-on-nodejs/

Node version : v0.11.6

先來看一看版本 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_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 (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))


不錯,我們可以通過awk來啟用所有的ES6新特性,需要跟 strict一起使用

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


Windows下啟用(通用方法)
來源: http://stackoverflow.com/questions/13351965/what-does-node-harmony-do

node --harmony app.js


看一個例子
作用域

關鍵字  let 可以讓我們將變量的作用范圍限定在一個代碼塊中

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 临泽县| 长葛市| 板桥市| 修武县| 诏安县| 崇州市| 望奎县| 临颍县| 思茅市| 普安县| 密云县| 精河县| 隆林| 灵川县| 揭西县| 仙居县| 吉水县| 山阳县| 龙南县| 阿尔山市| 深州市| 聂荣县| 浦江县| 越西县| 德令哈市| 泰兴市| 古蔺县| 保靖县| 微山县| 瑞金市| 吴忠市| 宁明县| 舞阳县| 灵寿县| 区。| 雷州市| 色达县| 轮台县| 宁乡县| 三河市| 清河县|