Learn JavaScript
Object Destructuring
35.3
Lesson

Set variable name using Colon

We can use colon to copy any object property into a variable with another name.

In the example given below, the fullName property is copied into the name variable and isAdmin property is copied into the admin variable. The age property is copied to the variable with the same name.