http://www.ecma-international.org/ecma-262/6.0/#sec-class-definitions
14.5 Class Definitions
Syntax
ClassDeclaration[Yield, Default] :
class BindingIdentifier[?Yield] ClassTail[?Yield]
[+Default] class ClassTail[?Yield]
ClassExpression[Yield] :
class BindingIdentifier[?Yield]opt ClassTail[?Yield]
ClassTail[Yield] :
ClassHeritage[?Yield]opt { ClassBody[?Yield]opt }
ClassHeritage[Yield] :
extends LeftHandSideExpression[?Yield]
ClassBody[Yield] :
ClassElementList[?Yield]
ClassElementList[Yield] :
ClassElement[?Yield]
ClassElementList[?Yield] ClassElement[?Yield]
ClassElement[Yield] :
MethodDefinition[?Yield]
static MethodDefinition[?Yield]
;
NOTE A ClassBody is always strict code.
https://chadaustin.me/2012/12/javascript-new-operator-ecma-262/
http://stackoverflow.com/questions/761905/how-will-ecma-262-ecmascript-5-help-you
https://blog.appdynamics.com/engineering/7-ways-es2015-can-improve-your-javascript-programing/
es6-in-depth-let-and-const
http://blog.herobs.cn/es6-in-depth-let-and-const/
let
和var
究竟有哪些具体的差异?let 变量是块级作用域。其作用域只在块中,而不再是整个函数。
for (let x...) 循环将会给每次循环创建一个新的 x 绑定。
任何尝试在 let 变量声明前使用变量将会抛出异常。(no hoisting ?)
使用 let 重复声明变量将会引起 Syntax Error(语法错误)。
let 在严格模式是一个保留关键词,在非严格模式中,为了能够后向兼容,你任然可以使用 let 作为变量名、函数名和参数名.
var let = 'aHa';
Closures
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Closures
https://www.w3schools.com/js/js_function_closures.asp
const
const 声明的变量和 let 是一样的,但是你不能给他们赋值,否则将会抛出语法错误
在声明 const 变量时, 给定初始值。