[js]展开运算符

function f(...args){
  console.log(args);
}

f(1,2,3,4,5)

[...args] = [1,2,3,4]

function f(...args){
  console.log(args);
}

let arr = [1,2,3,4]
f(...arr)

[a,...args] = [1,2,3,4]

function f(a, ...args){
  console.log(a, args);
}

let arr = [1,2,3,4]
f(...arr)

posted @ 2019-01-13 00:43  mmaotai  阅读(239)  评论(0编辑  收藏  举报