JavaScript ES6 教學
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

ES6 如何在class上模擬private data/method:

上述兩個link都提到兩種方式WeakMap & Symbol.

ES6裡的Prototype

class 本質上是prototype的syntactical sugar)的導入. [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain]
Since ECMAScript 6, the [[Prototype]] is accessed using the accessors Object.getPrototypeOf() and Object.setPrototypeOf().

let , const 為 block level 變數的關鍵字

1
if(true){
2
var x = 1;
3
}
4
console.log(x); //1
5
6
if(true){
7
let y = 2; //its lifetime is only in thie scope
8
}
9
console.log(y); //exception, undefined
Copied!

shorthand syntax of Method definitions

Given the following code:
1
var obj = {
2
foo: function() {},
3
bar: function() {}
4
};
Copied!
You are now able to shorten this to:
1
var obj = {
2
foo() {},
3
bar() {}
4
};
Copied!

其餘部份待補充, 可先參考

上面網站裡的功能清單 ES6 includes the following new features: