es6高級新特性

1.函數的rest參數和擴展:動態參數javascript es5以前寫多個參數函數的方式html functionsum(x,y,z){ lettotal=0; if(x)total+=x; if(y)total+=y; if(z)total+=z; console.log(`total:${total}`); } sum(5,"",9); es6添加rest參數以後能夠寫成以下方式,動態添加
相關文章
相關標籤/搜索