For example:
var myObject = { name : 'David', age: '30, salary:'30000' }
I need answers like: My name is David, I’m 30 years old. I earned monthly 30000.
Note: Without using ‘.’ DOT operator and for and foreach.
Advertisement
Answer
var myObject = { name : ‘David’, age: ’30’, salary:’30000′ } //object destructure
let {name, age, salary} = myObject;
console.log(my name is ${name}
)