Answers for "Assign keys to an object with the same name"

0

Assign keys to an object with the same name

let name = 'bob';let age = 34;let job = 'carpenter';// instead of thislet myObject1 = { name: name, age: age, job: job };// do thislet myObject2 = { name, age, job };console.log(myObject2);--> { name: 'bob', age: 34, job: 'carpenter' }
Posted by: Guest on July-24-2021

Code answers related to "Assign keys to an object with the same name"

Browse Popular Code Answers by Language