1
0
Fork 0
This commit is contained in:
Jason Williams 2019-09-29 12:29:54 -06:00
parent 38e23cf767
commit ef64250820
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
// Object property shorthand
const name = 'Jason'
const userAge = 38
const user = {
name,
age: userAge,
location: 'Calgary'
}
console.log(user)
// Object destructuring
const product = {
label: 'Red notebook',
price: 3,
stock: 201,
salePrice: undefined,
rating: 4.2
}
// const label = product.label
// const stock = product.stock
// const {label:productLabel, stock, rating = 5} = product
// console.log(productLabel)
// console.log(stock)
// console.log(rating)
const transaction = (type, {label, stock}) => {
console.log(type, label, stock)
}
transaction('order', product)