Last active
February 18, 2018 23:02
-
-
Save rohit012/311e930e6163acacfe2b8fcdedcb4e6e to your computer and use it in GitHub Desktop.
This file contains 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
var bodyObj = { | |
height: 16, | |
width: 9, | |
breadth: 20; | |
}; | |
//without destructuring | |
var height = bodyObj.height; | |
var width = bodyObj.width; | |
var breadth = bodyObj.breadth; | |
//with destructuring | |
let { height, width, breadth } = bodyObj; | |
// rename variable with destructuring | |
let { height: myHeight } = bodyObj; // will result in creating myHeight with value bodyObj.height in readonly mode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment