Naming
Names allow to identify variables, functions, types, labels and properties of objects. Rules for naming:
- first character may be one of A-Z, a-z, underscore _, or dollar sign $
- subsequent characters may be one of 0-9, A-Z, a-z, underscore _, or dollar sign $
- names are case sensitive, for example x and X are different variables
- name must not match the reserved word
You should also avoid using the name of
- JavaScript built-in objects, properties, and methods
- some Java objects and properties as JavaScript identifiers
- some Java objects and properties as JavaScript identifiers
- HTML and Window objects and properties
Reserved words
abstract | arguments | await* | 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 |
Words marked with* are new in ECMAScript 5/6.
ECMAScript 5/6 does not have full support in all browsers.