← Quiz: Classes, Modules, Map and Set: all 10 questions
Quiz: Classes, Modules, Map and Set · Question 2 of 10
What does this print? (code)
What does this print?
class A { hi() { return "A"; } }
class B extends A { hi() { return "B" + super.hi(); } }
console.log(new B().hi());
- A.A
- B.B
- C.BA
- D.AB
Answer & explanation
Correct answer: BA
B's hi overrides A's, then calls the parent version with super.hi().
Can you get the rest right without peeking?
Take the timed Quiz: Classes, Modules, Map and Set quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →