## 關(guān)鍵字和保留字
關(guān)鍵字和保留字,都不能用做標(biāo)識符的命名。
關(guān)鍵字:
~~~
break do instanceof typeof
case else new var
catch finally return void
continue for switch while
debugger function this with
default if throw delete
in try
~~~
保留字:
~~~
abstract enum int short
boolean export interface static
byte extends long super
char final native synchronized
class float package throws
const goto private transient
debugger implements protected volatile
double import public
~~~
第 5 版把在非嚴(yán)格模式下運(yùn)行時(shí)的保留字縮減為下列這些:
~~~
class enum extends super
const export import
~~~
在嚴(yán)格模式下,第 5 版還對以下保留字施加了限制:
~~~
implements package public interface
private static let protected
ield
~~~
>[danger] 其中的 let 和 ield 是在第 5 版中新增的,第 5 版中的嚴(yán)格模式下,eval 和 arguments 也不能做為標(biāo)識符或?qū)傩悦褂?
