Valid JS-Dev-101 Dumps shared by EduDump.com for Helping Passing JS-Dev-101 Exam! EduDump.com now offer the newest JS-Dev-101 exam dumps, the EduDump.com JS-Dev-101 exam questions have been updated and answers have been corrected get the newest EduDump.com JS-Dev-101 dumps with Test Engine here:
Refer to the code below: class Student { constructor(name) { this._name = name; } displayGrade() { console.log(`${this._name} got 70% on test.`); } } class GraduateStudent extends Student { constructor(name) { super(name); this._name = "Graduate Student " + name; } displayGrade() { console.log(`${this._name} got 100% on test.`); } } let student = new GraduateStudent("Jane"); student.displayGrade(); What is the console output?
Correct Answer: C
The correct answer is C, after correcting the option text to match the actual code. The object is created here: let student = new GraduateStudent("Jane"); Because GraduateStudent extends Student, its constructor runs: constructor(name) { super(name); this._name = "Graduate Student " + name; } The call to: super(name); runs the parent Student constructor first and temporarily sets: this._name = "Jane"; Then this line in the child constructor overwrites that value: this._name = "Graduate Student " + name; So the final value of this._name becomes: "Graduate Student Jane" Next, this line executes: student.displayGrade(); Since student is an instance of GraduateStudent, JavaScript uses the overridden displayGrade() method from GraduateStudent, not the parent method from Student. The executed method is: displayGrade() { console.log(`${this._name} got 100% on test.`); } Therefore, the console output is: Graduate Student Jane got 100% on test. Important correction: the original option C said something like "Better student Jackie got 100% on test.", but the actual code uses "Graduate Student " and the name "Jane". The verified corrected answer remains C.