2017.7.5
第三章
1.基本数据类型:Undefined
、Null
、Number
、String
、Boolean
。
2.switch
语句不仅能判断确定的值,还可以判断取值范围(如n>0
)。
var num = 25;
switch (true) {
case num < 0:
alert("Less than 0.");
break;
case num >= 0 && num <= 10:
alert("Between 0 and 10.");
break;
default:
alert("More than 10.");
}
3.函数体内可以通过arguments
对象来访问参数数组.arguments
对象只是与数组类似(它并不是Array
的实例)。另外可以通过访问arguments
对象的length
属性得到函数接收了几个参数。
function sayHi_1(name, message) {
alert("Hello " + name + "," + message);
}
function sayHi_2() {
alert("Hello " + arguments[0] + "," + arguments[1]);
}
4.ECMAScript函数没有重载。