Skip to content

Instantly share code, notes, and snippets.

Last active February 18, 2018 23:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rohit012/311e930e6163acacfe2b8fcdedcb4e6e to your computer and use it in GitHub Desktop.
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