可以利用arguments对象:
function test(){for(var i=0i<arguments.lengthi++){
console.log("第"+(i+1)+"个参数:"+arguments[i])
}
}
test(11,22,33,44,55,66)
test("aaa",88,new Date())
可以利用arguments对象:
function test(){for(var i=0i<arguments.lengthi++){
console.log("第"+(i+1)+"个参数:"+arguments[i])
}
}
test(11,22,33,44,55,66)
test("aaa",88,new Date())