javascript中的arguments的应用

  在javascript里面函数不能被重载,因此只能隐式调用arguments。

虽然arguments对象并不是一个数组,但是访问单个参数的方式与访问数组元素的方式相同

例如:

arguments[0],arguments[1],。。。。。。。。arguments[n],


function yang(){
console.info("hello" +" "+arguments[0]+","+arguments[1]);
}
test("bigfatDone","Welcome!");
输出:hello bigfatDone,Welcome

猜你喜欢

转载自blog.csdn.net/bigfatdone/article/details/80959627