Use Destructuring Assignment to Assign Variables from Objects, An ES6 Course Introduction

preview_player
Показать описание
In our ES6 course continuation we continue learning more about the destructuring syntax. In our previous lesson we saw how to exactly extract values from an object. In this lesson we will look at how to assign a variable a new name, if we so wished. We learn that doing this is very similar to extracting values. The syntax looks very similar. We similarly start with const followed by curly braces and end it with an equals sign followed by the name of the object that we want to re-assign key(variable) names. Within our curly braces we specify the key name followed by a colon, then the new name we would like to call it. We can target multiple keys by seperating them with commas.
Рекомендации по теме