The Wayback Machine - https://web.archive.org/web/20201101020107/https://dev.to/codefinity/array-destructuring-spread-58id
loading...
Cover image for Array Destructuring/Spread

Array Destructuring/Spread

codefinity profile image Manav Misra ・1 min read

Overview

Welp...that says it all 👆🏽.

If we wanted to destructure the first 3 elements in an array: const [veg1, veg2, veg3] = ["Cabbage", "Turnip", "Radish", "Carrot"]

Those 3 dots: ... are a spread operator. That's why in the above repl.it 👆🏽, we can pull out the first element(s) and then still keep the rest of them in another array.

Discussion

 

Thank you for doing this serie. I'm learning react native and this helps a lot

 

By all means, do learn 'vanilla JS' as much as you can. Ironically, I have not done any 'React Native' myself - just 'regular React.' I'll surely get to that - maybe you can post something on that to get me started. 😃