js保留的关键字
js保留的关键字
break | else | new | var |
case | finally | return | void |
catch | for | switch | while |
continue | function | this | with |
default | if | throw | |
delete | in | try | |
do | instanceof | typeof |
还有一些关键字用于未来扩展语言功能的,也不建议用作js标识符
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 |
根据ECMAScript5,关键字 if、 super 和 public 可以用作对象的属性名,但鉴于其特殊性,不推荐使用。