Question 1
Back to Exercise
JavaScript refuses to run the code below. Which statement correctly describes the problem?
const user = {
name: "Asha"
age: 21,
};
console.log(user.age);
- A SyntaxError: properties must be separated by commas – a comma is missing after "Asha" Correct
- B It prints 21
- C It prints undefined
- D ASI inserts the missing comma
Correct Answer: Option A
Automatic semicolon insertion never inserts commas. Inside an object literal every property except the last needs a comma after it.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!