Be the first user to complete this post

  • 0
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"]


[wpgist id="da34b2c565521c39ba22a9f6b09b42a3" file="spread-operator-push.js"]


[wpgist id="da34b2c565521c39ba22a9f6b09b42a3" file="spread-operator-math-max.js"]


[wpgist id="da34b2c565521c39ba22a9f6b09b42a3" file="spread-operator-array.js"]

Also Read:

  1. Passing the store down implicitly via context in a react redux app
  2. Generating container components with connect utility in react redux app
  3. Error handling in promises interview question
  4. Use es6 and es6+ in eslint with babel
  5. exports is not defined
  6. Dynamic module loading with require
  7. combineReducers in reduxjs explained