What would be the output of the following code snippet? (Prototype method invocation)
@Yomesh Gupta
function Person(name) {
this.name = name;
}
Person.prototype.getName = () => {
return this.name;
};
const yomesh = new Person('Yomesh');
console.log(yomesh.getName());
Option 1
undefined
Option 2
Value of the property name on the global object
Option 3
Yomesh
Option 4
Empty String
Option 5
Error: getName is not a function
Option 6
Window