1、js语句以;号结束
var num = 1;
2、标识符(变量名)
标识符由字母、美元符号($)、下划线、数字组成,其中不能以数字开头。
var sum_account = 0;
3、保留关键字
注意保留关键字是不可以用于命名变量的:
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 |