标签:concat ota console var class 语法 es6 highlight script
function sum(x,y,z){ let total = 0; if(x)total+=x; if(y)total+=y; if(z)total+=z; console.log(`total:${total}`); } sum(5,‘‘,9) function sum2(...m){ let total = 0; for(var i of m){ total+=i; } console.log(`total:${total}`) } sum2(4,8,9,10); let sum3 = (...m)=>{ let total = 0; for(var i of m){ total+=i; } console.log(`total:${total}`); } sum3(4,8,9,10); // var [x,y] = [4,8] console.log(...[4,8]); let arr1 = [1,3];let arr2 = [4,8]; console.log("concat: "+arr1.concat(arr2)); console.log([...arr1,...arr2]); // var [x,y] = [4,8]; var [x,...y] = [4,8,10,30]; let [a,b,c]= ‘es6‘; let xy = [...‘es6‘];
标签:concat ota console var class 语法 es6 highlight script
原文地址:http://www.cnblogs.com/zhoujx1066/p/7765675.html