擴展運算符 let zzz=[2,4,6]; console.log(zzz);//[2, 4, 6] console.log(...zzz);//2 4 6 let a=[1,2,3]; let b=[...a,4,5,6]; console.log(b);//1,2,3,4,5,6 let [a ...
擴展運算符
let zzz=[2,4,6];
console.log(zzz);//[2, 4, 6]
console.log(...zzz);//2 4 6
let a=[1,2,3];
let b=[...a,4,5,6];
console.log(b);//1,2,3,4,5,6
let [a,b,...c]=[1,2,3,4,5];
console.log(a,b);//1 2
console.log(c);//[3, 4, 5]
箭頭函數
let say333=()=>{
console.log("333");//333
}
say333();
(name)=>{
console.log(name);
}
(a,b)=>{
return a+b;
}
(a,b)=> a+b;
參數預設值,剩餘參數,拓展參數
let aa=(name='wwrs')=>{
console.log(`Hello ${name}`);
}
aa();//Hello wwrs
aa('sss');//Hello sss
let bb=(a,b,c)=>{
console.log(a+b+c);//9
}
let dd=[2,3,4];
bb(...dd);
let he=(a,b,c,d)=>{
console.log(a+b+c+d);//10
}
he(1,2,3,4)
let he1=(s,j,...shi)=>{
console.log(shi);//[3, 4]
}
he1(1,2,3,4)