学习自W3School(英文版):http://www.w3schools.com/js/js_statements.asp
"It is normal to add a semicolon at the end of each executable statement. ........
The semicolon is optional (according to the JavaScript standard), and the browser is supposed to interpret the end of the line as the end of the statement. Because of this you will often see examples without the semicolon at the end...........
Using semicolons makes it possible to write multiple statements on one line"
经常会在javascript的每条语句后面加上分号,但是分号是可选的,默认情况下浏览器会自动将一行的结束当成是一个语句的结束;分号可以使得一行中有多个语句。
javascript comments:
"Single line comments start with //"
"Multi line comments start with /* and end with */."
JavaScript Variables
"Variable names are case sensitive (y and Y are two different variables"
变量名大小写敏感
“Variable names must begin with a letter, the $ character, or the underscore character”
变量名的开头必为字母、$符、_
"You declare JavaScript variables with the var keyword:"
变量的声明或定义必须一var关键字开头
变量有局部和全局之分
“If you assign values to variables that have not yet been declared, the variables will automatically be declared as global variables.”
对未声明的变量赋值,该变量会自动转变为全局变量(作用域就是赋值处开始到文件结尾)
Comparison Operators
特别的
"=="和
"===":==是值等于,===是值和类型的相等