DEV Community

Cover image for Array Destructuring/Spread
Manav Misra
Manav Misra

Posted on

2 3

Array Destructuring/Spread

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.

Top comments (2)

Collapse
 
sami_hd profile image
Sami β€’

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

Collapse
 
codefinity profile image
Manav Misra β€’

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. πŸ˜ƒ

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay