JavaScript变量名称命名规范
JavaScript中命名规范如下:
1、不能使用关键字或保留字作为变量名称
2、可以使用英文词汇、拼音命名
3、可以使用驼峰命名 loginButton
4、可以使用下划线
5、不能使用特殊符号命名,除了$和_可以,-也不可以
6、不可以使用数字开头
7、可以使用中文命名但是不建议使用
JavaScript关键字保留字
在JavaScript 中,一些标识符是保留字或关键字,变量和函数不能用这些作为名称。
参考地址:JavaScript 保留关键字 | 菜鸟教程
JavaScript 保留关键字
| abstract | arguments | boolean | break | byte |
| case | catch | char | class* | const |
| continue | debugger | default | delete | do |
| double | else | enum* | eval | export* |
| extends* | false | final | finally | float |
| for | function | goto | if | implements |
| import* | in | instanceof | int | interface |
| let | long | native | new | null |
| package | private | protected | public | return |
| short | static | super* | switch | synchronized |
| this | throw | throws | transient | true |
| try | typeof | var | void | volatile |
| while | with | yield |
JavaScript 对象、属性和方法
| Array | Date | eval | function | hasOwnProperty |
| Infinity | isFinite | isNaN | isPrototypeOf | length |
| Math | NaN | name | Number | Object |
| prototype | String | toString | undefined | valueOf |
Java 保留关键字
| getClass | java | JavaArray | javaClass | JavaObject | JavaPackage |
Windows 保留关键字
| alert | all | anchor | anchors | area |
| assign | blur | button | checkbox | clearInterval |
| clearTimeout | clientInformation | close | closed | confirm |
| constructor | crypto | decodeURI | decodeURIComponent | defaultStatus |
| document | element | elements | embed | embeds |
| encodeURI | encodeURIComponent | escape | event | fileUpload |
| focus | form | forms | frame | innerHeight |
| innerWidth | layer | layers | link | location |
| mimeTypes | navigate | navigator | frames | frameRate |
| hidden | history | image | images | offscreenBuffering |
| open | opener | option | outerHeight | outerWidth |
| packages | pageXOffset | pageYOffset | parent | parseFloat |
| parseInt | password | pkcs11 | plugin | prompt |
| propertyIsEnum | radio | reset | screenX | screenY |
| scroll | secure | select | self | setInterval |
| setTimeout | status | submit | taint | text |
| textarea | top | unescape | untaint | window |
HTML 事件句柄
| onblur | onclick | onerror | onfocus |
| onkeydown | onkeypress | onkeyup | onmouseover |
| onload | onmouseup | onmousedown | onsubmit |
