asked 158k views
1 vote
Using object literal enhancement, you can put values back into an object. When you log person to the console, what is the output?

const name = 'Rachel';
const age = 31;
const person = { name, age };
(person);

Please provide the output that you expect when logging person to the console.

1 Answer

6 votes

Final answer:

The output when logging person to the console would be an object with the properties name and age set to their respective values.

Step-by-step explanation:

When logging person to the console, the output would be:

{
name: 'Rachel',
age: 31
}

Using object literal enhancement, the variables name and age are directly assigned as values to the properties name and age of the person object. The resulting output is an object with the properties name and age set to their respective values.

answered
User Lkamal
by
8.1k points