Skip to content
Advertisement

How to get the value of iterating object? Without using foreach and dot operator

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})

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement