Here is a simple exercise that i don't finish to understund:
const myObj = {
name: 'Max',
age: 28
}
const {name} = myObj;
console.log(name); // prints 'Max'
console.log(age); // prints undefined
console.log(myObj); // prints {name: 'Max', age: 28}
This is an exercise i found in a course i'm taking. The problem is that when i try the exercise in JSBin it only works console.log(name); the other two prints return this error:
"Max"
"error"
"@cotehixumi.js:24:1
Any help? Thanks!