第一章介绍JavaScript历史,略!

   第二章介绍词法结构

      2.1 字符集 JavaScript程序采用Unicode字符集编码

      2.2 大小写敏感,不同于html代码,while不等于While

      2.3 JavaScript忽略空白符以及换行符

      2.4 可选的分号,如果语句不在同一行中,可以省略分号(但不是好的编程习惯),var a=3;b=4中分号不可以省略

      2.5 注释 

View Code
1 1 <script type="text/javascript">
2  2 //this is a single-line comment
3  3 /* this is also a comment*/
4 4 /*This is yet another comment
5 5 *It has multiple lines
6 6 */
7 7 </script>

      2.6 直接量

View Code
1 <script type="text/javascript">
2 12 //The number twelve
3 1.2 //The number one point two
4 "Hello World" //a string of text
5 true //A Boolean string
6 null //Absence of an object
7 {x:1,y:2} //An object initializer
8 [1,2,3,4,5] //An array initializer
9 </script>

     2.7 标识符 第一个字符必须是字母,下划线(_)或美元符号($),不能与关键字同名