es6提供了三点运算符,用作于可变参数;
function foo(...value){ console.log(value); value.forEach(function(item,index){ console.log(item,index); }); } foo(1,4);
还可以用于数组的内容拼接:
let arr1=[1,2]; let arr2=[2,3,4,5]; arr1=[1,...arr2,6]; console.log(arr1)
上一篇:es6箭头函数
下一篇:vue-cli · Failed to download repo vuejs-templates/webpack: unable to verifythe first certificate