和其餘任何編程語言同樣,JavaScript 保留了一些標識符爲本身所用。編程
JavaScript 一樣保留了一些關鍵字,這些關鍵字在當前的語言版本中並無使用,但在之後 JavaScript 擴展中會用到。瀏覽器
JavaScript 標識符必須以字母、下劃線(_)或美圓符($)開始。編程語言
後續的字符能夠是字母、數字、下劃線或美圓符(數字是不容許做爲首字符出現的,以便 JavaScript 能夠輕易區分開標識符和數字)。this
如下是 JavaScript 中最重要的保留字(按字母順序):debug
abstract | else | instanceof | super |
boolean | enum | int | switch |
break | export | interface | synchronized |
byte | extends | let | this |
case | false | long | throw |
catch | final | native | throws |
char | finally | new | transient |
class | float | null | true |
const | for | package | try |
continue | function | private | typeof |
debugger | goto | protected | var |
default | if | public | void |
delete | implements | return | volatile |
do | import | short | while |
double | in | static | with |
不是全部的 JavaScript 語句都是"命令"。雙斜槓 // 後的內容將會被瀏覽器忽略:code