I am confused about the spread syntax and rest parameter in ES2015. Can anybody explain the difference between them with proper examples?
When using spread, you are expanding a single variable into more:
var abc = ['a', 'b', 'c']; var def = ['d', 'e', 'f']; var alpha = [ ...abc, ...def ]; console.log(alpha)// alpha == ['a', 'b', 'c', 'd', 'e', 'f'];
1.4m articles
1.4m replys
5 comments
57.0k users