Created
October 4, 2018 08:59
-
-
Save kuanhsuh/04c50c10b0a12e6038e57124a8728ebf 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
// Nesting | |
// Give Variable a new name | |
const phone = { | |
type: 'iphone xsmax', | |
ssd: '128GB' | |
} | |
const {type} = phone | |
const {type: model} = phone | |
console.log(type) | |
console.log(model) | |
const order = { | |
data: { | |
item: "Macbook 13", | |
specs: { | |
ram: 16, | |
ssd: "1TB" | |
}, | |
status: "已送出" | |
} | |
} | |
const {data: { item }} = order | |
const {data: { item: computer }} = order | |
const { data: { specs: { ssd }}} = order | |
console.log(item) | |
console.log(computer) | |
console.log(ssd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment