0 votes
in JavaScript by
What's the output?
const obj = { a: 'one', b: 'two', a: 'three' };
console.log(obj);
  • A: { a: "one", b: "two" }
  • B: { b: "two", a: "three" }
  • C: { a: "three", b: "two" }
  • D: SyntaxError

1 Answer

0 votes
by
Answer: C

If you have two keys with the same name, the key will be replaced. It will still be in its first position, but with the last specified value.

Related questions

0 votes
asked Mar 10 in JavaScript by DavidAnderson
0 votes
asked Mar 7 in JavaScript by DavidAnderson
...