关键字和标识符命名


Javascript关键字

  ECMAScript通常每年发布一个标准,不过2009~2015年之间几乎无变化,2015年大更新。关键字会随着标准制定改变, 有些保留字在新的版本里面就会成为关键字, 比如原来的保留字class、const、let在ECMAScript2015标准里面都是关键字

ECMAScript2009关键字

  ECMAScript2009(ES5)标准,该标准2009年制

case else new default var
in try delete return void
continue for if switch while
break throw do instanceof typeof
debugger function this with catch
finally

ECMAScript2015关键字

  ECMAScript2015(ES6)标准,该标准2015年制。

break do delete import typeof
case else try in var
catch instanceof export new void
class extends default if while
const finally throw super with
continue for return switch yield
debugger function this let

ECMAScript3保留字

  ECMAScript保留字就不一一列举了,大家有保留字的意识就可以,保留字和关键字一样会随着标准制定改变,

abstract boolean byte char class
const debugger double enum export
extends final float goto implements
import int interface long native
package private protected public short
static super synchronized throws transient
volatile

变量名、函数名等标识符命名规则

标识符命名建议