nodejs支持es6吗? - 网站

nodejs支持es6吗?

分类:Node.js常见问题 · 发布时间:2019-08-07 10:55 · 阅读:3770

ECMAScript 6.0,简称ES6,第一个版本是在2015年6月进行发布,所以也称之为《ECMAScript 2015 标准》(简称 ES2015)。nodejs运行时支持90%的es6,仍有一些高级功能不支持es6。

查看nodejs对es6的支持情况:

使用es-checker工具包查看

npm install -g es-checker
es-checker

node v4.2.6 支持情况如下:

ECMAScript 6 Feature Detection (v1.4.1)
Variables
  √ let and const
  √ TDZ error for too-early access of let or const declarations
  √ Redefinition of const declarations not allowed
  √ destructuring assignments/declarations for arrays and objects
  √ ... operator
Data Types
  √ For...of loop
  √ Map, Set, WeakMap, WeakSet
  √ Symbol
  √ Symbols cannot be implicitly coerced
Number
  √ Octal (e.g. 0o1 ) and binary (e.g. 0b10 ) literal forms
  √ Old octal literal invalid now (e.g. 01 )
  √ Static functions added to Math (e.g. Math.hypot(), Math.acosh(), Math.imul() )
  √ Static functions added to Number (Number.isNaN(), Number.isInteger() )
String
  √ Methods added to String.prototype (String.prototype.includes(), String.prototype.repeat() )
  √ Unicode code-point escape form in string literals (e.g. \u{20BB7} )
  √ Unicode code-point escape form in identifier names (e.g. var \u{20BB7} = 42; )
  √ Unicode code-point escape form in regular expressions (e.g. var regexp = /\u{20BB7}/u; )
  √ y flag for sticky regular expressions (e.g. /b/y )
  √ Template String Literals
Function
  √ arrow function
  √ default function parameter values
  √ destructuring for function parameters
  √ Inferences for function name property for anonymous functions
  × Tail-call optimization for function calls and recursion
Array
  × Methods added to Array.prototype ([].fill(), [].find(), [].findIndex(), 
      [].entries(), [].keys(), [].values() )
  √ Static functions added to Array (Array.from(), Array.of() )
  √ TypedArrays like Uint8Array, ArrayBuffer, Int8Array(), Int32Array(), Float64Array()
  √ Some Array methods (e.g. Int8Array.prototype.slice(), Int8Array.prototype.join(), 
      Int8Array.prototype.forEach() ) added to the TypedArray prototypes
  √ Some Array statics (e.g. Uint32Array.from(), Uint32Array.of() ) 
      added to the TypedArray constructors
Object
  √ __proto__ in object literal definition sets [[Prototype]] link
  √ Static functions added to Object (Object.getOwnPropertySymbols(), Object.assign() )
  √ Object Literal Computed Property
  √ Object Literal Property Shorthands
  √ Proxies
  √ Reflect
Generator and Promise
  √ Generator function
  √ Promises
Class
  √ Class
  √ super allowed in object methods
  √ class ABC extends Array { .. }
Module
  × Module export command
  × Module import command
=========================================
Passes 38 feature Detections
Your runtime supports 90% of ECMAScript 6
=========================================
标签:
nodejs

相关文章

如何设置 nodejs 的环境变量

在前端开发过程中,我们需要对 application 运行的环境进行设置,一般会包括开发环境development,生产环境production,每个环境可以对应不同的一些配置,例如不同环境下请求的地址...

谈谈Node.js与JavaScript的差异

Javascript是一种web前端语言,主要用于web开发中,由浏览器解析执行。Node.js是一个可以快速构建网络服务及应用的平台,是用Javascript语言构建的服务平台。

npm install安装报错怎么解决?

解决方法:1、报“operation not permitted”错误,通过“npm i 包名 --no-optional”解决;2、报“Missing: chromedriver”错误,表示没有安装chromedriver,安装一下即可。

怎么使用npm下载vue.js?

使用npm下载vue.js的方法:1、安装node.js和npm;2、安装cnpm;3、使用命令cnpm install -g vue-cli来安装即可。

vue.js和node.js是什么关系?

vue.js和node.js并没有关系,vue.js是前端框架,算是js的三大框架之一吧,node.js是后端开发语言,同php、java、c#一样的。但是他们可以配合使用。

返回分类 返回首页