Be the first user to complete this post
|
Add to List |
Es6 Spread operator
A spread operator allows an expressions to be expanded.It allows the elements of an array to be expanded, so you do not have to loop over all the array elements in the function. In this post, we will see few practical use cases for the spread operator.
An array to be expanded as multiple arguments to the function
[wpgist id="da34b2c565521c39ba22a9f6b09b42a3" file="spread-operator-function.js"]Array.prototype.push
[wpgist id="da34b2c565521c39ba22a9f6b09b42a3" file="spread-operator-push.js"]Array.prototype.Math
[wpgist id="da34b2c565521c39ba22a9f6b09b42a3" file="spread-operator-math-max.js"]Array.prototype.concat
[wpgist id="da34b2c565521c39ba22a9f6b09b42a3" file="spread-operator-array.js"]Also Read:
- Redux: Implementing store from scratch
- Generating container components with connect utility in react redux app
- Use node in es6 syntax with babel transpiling
- Disable eslint no-unused-vars warning on global functions