Javascript中的关键字和保留字整理
ECMA-262中描述了一组具有特定用途的关键字,可用于表示控制语句的开始或结束,或者用于执行特定操作等。规定:关键字属于语言保留,不可以用于标示符。
ECMAScript的全部关键字(*为第五版新增):
breakdoinstanceoftypeofcaseelsenewvarcatchfinallyreturnvoidcontinueforswitchwhiledebugger* functionthiswithdefaultifthrowdeleteintry
ECMA-262中的全部保留字(第三版):
abstractenumintshortbooleanexportinterfacestaticbyteextendslongsupercharfinalnativeclass
synchronizedfloatpackagethrowsconstgotoprivatetransientdebuggerimplementsprotectedvolatiledouble
importpublic
保留字可能会作为再版的关键字,如第五版新增的debugger就是第三版的保留字。
第五版中非严格模式下的保留字:
classenumextendssupperconstexportimport
严格模式下保留字:
implementspackagepublicinterfaceprivatestaticletprotectedyield
注意:let和yield为新增保留字;为保证兼容建议作为参考保留字。
在Javascript中使用关键字和保留字会报错。不建议使用!
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短