一、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