[js]展开运算符

时间:2023-12-16 12:59:26
function f(...args){
console.log(args);
} f(1,2,3,4,5)

[js]展开运算符

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

function f(...args){
console.log(args);
} let arr = [1,2,3,4]
f(...arr)

[js]展开运算符

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

function f(a, ...args){
console.log(a, args);
} let arr = [1,2,3,4]
f(...arr)

[js]展开运算符