Created
August 16, 2023 16:22
-
-
Save suhailgupta03/c7ed3f9b8e0beea51f43e2f19f745515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let employee = { | |
name: 'John', | |
age: 30, | |
salary: 1000 | |
} | |
let {salary, name} = employee; | |
// this is an example of destructuring | |
// assignment. We call this as destructuring | |
// because we are destructuring the object | |
// employee into two variables salary | |
// and name | |
console.log(salary); // 1000 | |
console.log(name); // John |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Array example: https://gist.github.com/suhailgupta03/a4ac188a30d5235154682956b3ef6524