标签:数组 var log sum console cat 运算 判断 eof
let sum=(...m)=>{
console.log(m[0]);
//经判断m为数组
console.log(m instanceof Array);
}
sum(1,2,3);
//此时...为运算符将4和8进行拆解
// var [x,y]=[4,8];
console.log(...[4,8]);
let arr1=[1,2],arr2=[4,8];
//[1, 2, 4, 8]
console.log(arr1.concat(arr2));
//[1, 2, 4, 8]
console.log([...arr1,...arr2]);
var [x,...y]=[1,84,654,8,4];
//x=1,y=[84,654,8,4]
var [a,b,c]="es6";
//a=e,b=s,c=6;
var xy=[..."es6"];
//xy=["e", "s", "6"]
标签:数组 var log sum console cat 运算 判断 eof
原文地址:https://www.cnblogs.com/wangxirui/p/9029324.html