Default args
可以將在function的參數給予預設值
1 | function fnWithDefaultArg(a,b=[]){ |
Spread operator
The spread operator allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) are expected.
1 | function fn(a,b,c){ |
A more powerful array literal
1 | var parts = ['shoulders', 'knees']; |
A better push
1 | var arr1 = [0, 1, 2]; |