Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.