Question 3
Back to Exercise
After o[1] = "a"; o["1"] = "b";, how many properties does o (initially empty) have?
- A 1 – the number 1 is converted to the string "1", so both lines set the same property Correct
- B 2
- C 0
- D It throws a TypeError
Correct Answer: Option A
Object keys are strings (or symbols). The second assignment overwrites the first, so o[1] is "b".
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!