Q: 7
Refer to the code below:
Function Person(firstName, lastName, eyecolor) {
this.firstName =firstName;
this.lastName = lastName;
this.eyeColor = eyeColor;
}
Person.job = ‘Developer’;
const myFather = new Person(‘John’, ‘Doe’);
console.log(myFather.job);
What is the output after the code executes?
Options
Discussion
Option A here. The trap is D but the typo in the parameter name (eyecolor vs eyeColor) means ReferenceError is thrown, so myFather doesn't even get created. Seen similar Qs in practice exams.
A tbh, looks like the typo in eyeColor causes a ReferenceError. Can someone confirm if that's right?
Be respectful. No spam.
Question 7 of 30