- ES6 provides a new operator called spread operator that consists of three dots (...).
- The spread operator allows you to spread out elements of an iterable object such as an array,a map, or a set.
- Above example, the three dots (...) located in front of the oddValue and evenValue array is the spread operator.
- The spread operator unpacks the elements of the oddValue and evenValue array.
Summary
- The spread operator is denoted by three dots (…).
- The spread operator unpacks elements of iterable objects such as arrays, sets, and maps into a list.
- The spread operator can be used to clone an iterable object or merge iterable objects into one.
Top comments (2)
cool!
Thank You! This is my first blog post.
" Congratulations for @CodeLighthouse.io "