Skip to content

Instantly share code, notes, and snippets.

@mbifulco mbifulco/index.html
Created Mar 28, 2019

Embed
What would you like to do?
// source https://jsbin.com
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
'use strict';
var address = {
line1: '123 Fake Street',
line2: 'Apartment 12',
city: 'Springfield',
state: 'IL',
zip: '22223',
directions: {
contactNumber: '555-555-1212',
message: 'Knock on the front door, please',
editedBy: {
userId: '123445',
displayName: 'Milky Bee'
}
}
};
var zip = address.zip;
var _address$directions = address.directions;
var message = _address$directions.message;
var _address$directions$editedBy = _address$directions.editedBy;
var displayName = _address$directions$editedBy.displayName;
var userId = _address$directions$editedBy.userId;
console.log('my zip code is ' + zip);
console.log('special directions are ' + message);
console.log('directions last edited by ' + displayName + '<' + userId + '>');
</script>
<script id="jsbin-source-javascript" type="text/javascript">const address = {
line1: '123 Fake Street',
line2: 'Apartment 12',
city: 'Springfield',
state: 'IL',
zip: '22223',
directions: {
contactNumber: '555-555-1212',
message: 'Knock on the front door, please',
editedBy: {
userId: '123445',
displayName: 'Milky Bee',
}
}
};
const { zip } = address;
const {
directions : {
message,
editedBy: {
displayName,
userId,
},
}
} = address;
console.log(`my zip code is ${zip}`);
console.log(`special directions are ${message}`);
console.log(`directions last edited by ${displayName}<${userId}>`)</script></body>
</html>
'use strict';
var address = {
line1: '123 Fake Street',
line2: 'Apartment 12',
city: 'Springfield',
state: 'IL',
zip: '22223',
directions: {
contactNumber: '555-555-1212',
message: 'Knock on the front door, please',
editedBy: {
userId: '123445',
displayName: 'Milky Bee'
}
}
};
var zip = address.zip;
var _address$directions = address.directions;
var message = _address$directions.message;
var _address$directions$editedBy = _address$directions.editedBy;
var displayName = _address$directions$editedBy.displayName;
var userId = _address$directions$editedBy.userId;
console.log('my zip code is ' + zip);
console.log('special directions are ' + message);
console.log('directions last edited by ' + displayName + '<' + userId + '>');
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.