corrected some errors

pull/77/head
Emmanuel-Odinaka 5 years ago
parent d38ff15bd7
commit cfaf650940

@ -3045,12 +3045,12 @@ const rectangle = {
} }
let width = rectangle.width let width = rectangle.width
let height = recangle.height let height = rectangle.height
// or // or
let width = rectangle[width] let width = rectangle[width]
let height = recangle[height] let height = rectangle[height]
``` ```
But today, we will see how to access the value of an object using destructuring. But today, we will see how to access the value of an object using destructuring.
@ -3064,7 +3064,7 @@ const rectangle = {
} }
let { width, height } = rectangle let { width, height } = rectangle
console.log(width, height, perimeter) // 20, 10 console.log(width, height, perimeter) // 20, 10, undefined
``` ```
What will be the value of we try to access a key which not in the object. What will be the value of we try to access a key which not in the object.
@ -3075,7 +3075,8 @@ const rectangle = {
height: 10, height: 10,
} }
let { width, height, perimeter } = rectangleconsole.log( let { width, height, perimeter } = rectangle
console.log(
width, width,
height, height,
perimeter perimeter
@ -3095,7 +3096,7 @@ const rectangle = {
} }
let { width, height, perimeter = 200 } = rectangle let { width, height, perimeter = 200 } = rectangle
console.log(width, height, perimeter) // 20, 10, undefined console.log(width, height, perimeter) // 20, 10, 200
``` ```
Renaming variable names Renaming variable names

Loading…
Cancel
Save