Use Destructuring Assignment to Assign Variables from Arrays, Learning JS ES6 2020, Web Dev

preview_player
Показать описание
In this lesson we continue learning about destructuring syntax in ES6. We target array destructuring in this lesson and find out it is very similar to destructuring an object. We learn that we are able to target items in an array by using destructuring syntax. The difference is, that in the past we used curly braces, but if we want to assign our variables values from an array, we must use commas to assign our variables the proper value. If we wanted to grab a value from the 5th item in an array, but not the first 5, we would use 4 commas to denote we want to only grab the 5th value. Learning to use destructuring assignment to assign our variables values from arrays can make our code easier to read and manage and is a vital es6 skill to have.
Рекомендации по теме