Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
Yup! Check out this post if you want that example specifically. It's essentially grabbing each element in the array and dropping it into a new array structure.
Probably my most common use case is merging an array or object into something I'm defining. Like so:
You said that it always creates an array, right? Would the result be
[[1,2,3,4], 6,7,10]
?...Oh, nevermind, just tried it in the console! It flattens it; that makes a lot of sense!
Yup! Check out this post if you want that example specifically. It's essentially grabbing each element in the array and dropping it into a new array structure.
5 Uses for the Spread Operator
Laurie ・ Jul 10 ・ 3 min read