国产探花免费观看_亚洲丰满少妇自慰呻吟_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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 纳雍县| 山丹县| 龙山县| 启东市| 沧源| 磐石市| 镇平县| 宁远县| 贵港市| 临沧市| 增城市| 黑河市| 兰坪| 武山县| 霍城县| 郸城县| 红桥区| 鄱阳县| 安康市| 桐城市| 筠连县| 崇文区| 莱州市| 潼南县| 贵州省| 嘉峪关市| 正蓝旗| 渝北区| 贵州省| 阳江市| 江油市| 郓城县| 上杭县| 遂昌县| 霍林郭勒市| 金川县| 龙泉市| 洪湖市| 新昌县| 布尔津县| 和龙市|