一、js把一些标识符拿出来用做本身的关键字。所以,就不能再在程序中把这些关键字用做标识符了:函数
1 break delete function return typeof 2 case do if switch var 3 catch else in this void 4 continue false instanceof throw while 5 debugger finally new true with 6 default for null try
二、js一样保留了一些关键字,这些关键字在当前语言版本中并无用到,但在将来版本中可能会用到。ES5保留了这些关键字: this
class const enum export extends import super
三、此外,下面的这些关键字在普通的 js 代码中是合法的,可是在严格模式下是保留字: spa
1 implements let private public yield 2 interface package protected static
四、严格模式一样对下面的标识符的使用作了严格限制,它们并不彻底是保留字,但不能用做变量名、函数名或参数名:debug
1 arguments eval code
五、ES3 将 Java 的全部关键字都列为本身的保留字,尽管这些保留字在 ES5 中放宽了限制,但若是你但愿代码能在基于 ES3 实现的解释器上运行的话,应当避免使用这些关键字做为标识符:blog
1 abstract double goto native static 2 boolean enum implements package super 3 byte export inport private synchronized 4 char extends int protected throws 5 class final interface public transient 6 const float long short volatile
六、js 预约义了不少全局变量和函数,应当避免把它们的名字当作变量名和函数名it
1 arguments encodeURI Infinity Number RegExp 2 Array encodeURIComponent isFinite Object String 3 Boolean Error isNaN parseFloat SyntaxError 4 Date eval JSON parseInt TypeError 5 decodeURI EvalError Math RangeError undefined 6 decodeURIComponent Function NaN ReferenceError URIError