es5
function a (){
console.log(arguments)
}
a(1,2,3,4,5)
结果=> [1,2,3,4,5]
function a (x,...arguments){
console.log(arguments)
}
a(1,2,3,4,5)
结果=> [2,3,4,5]
es6箭头函数
const a => (...arguments){
console.log(arguments)
}
function a (){
console.log(arguments)
}
a(1,2,3,4,5)
结果=> [1,2,3,4,5]
function a (x,...arguments){
console.log(arguments)
}
a(1,2,3,4,5)
结果=> [2,3,4,5]
const a => (...arguments){
console.log(arguments)
}
本文标题:arguments用法
本文链接:https://www.haomeiwen.com/subject/bqxveltx.html
网友评论