js函数传参,不论传多少参数,最终都是通过arguments对象来访问这个数组,从而获得每个参数。
function sayHi(){
console.log("hello,"+arguments[0]+","+arguments[1]);
}
function howManyArgs(){
console.log(arguments.length);
}
howManyArgs("string",45); //2
howManyArgs(); //0
howManyArgs(12); //1