JavaScript ES6 教學
Last updated
Last updated
ES6 = ECMAScript 6 = ECMAScript 2015.
ES6 還是未有直接support class的 private member.
當使用const/let等時, 且在node.js上, 則一定要運行在Strict Mode Code下, 即use strict
. 不然會出現 Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
上述兩個link都提到兩種方式WeakMap & Symbol.
class
本質上是prototype的syntactical sugar)的導入. []
Since ECMAScript 6, the [[Prototype]] is accessed using the accessors Object.getPrototypeOf() and Object.setPrototypeOf().
Given the following code:
You are now able to shorten this to:
上面網站裡的功能清單 ES6 includes the following new features: