3.1、语法
1、区分大小写
2、标识符:指变量、函数、属性的名字,或者函数的参数;第一个字符必须是一个字母/下划线( _ )/一个美元符号($);其他字符可以是字母、下划线、美元符号或数字
3、注释
// 单行注释
/*
* 多行注释
* 块级注释
*/
4、严格模式
“use strict”
function doSomething(){
"use strict";
//函数体
}
5、语句(略)
3.2、关键字和保留字
//关键字
break do instanceof typeof case else new var catch finally
return void continue for switch while debugger* function
this with default if throw delete in try
//保留字
abstract enum int short boolean export interface static
byte extends long super char final native synchronized
class float package throws const goto private transient
debugger implements protected volatile double import public
//第五版在非严格模式下运行时保留字缩减为下列这些:
class enum extends super const export import
//严格模式下,第五版对以下保留字加了限制:
implements package public interface private static let
protected yield