What would be the output? [New Operator | Explicit Non Primitive Return]
@Yomesh Gupta
function Person(name) {
this.name = name;
var person = {
name: 'Ajay'
};
function person() {
return {
name: 'Prithvi'
};
}
return person;
}
var yomesh = new Person('Yomesh');
console.log(yomesh);
Option 1
{"name":"Yomesh"}
Option 2
undefined
Option 3
Error
Option 4
{"name":"Ajay"}
Option 5
{"name":"Prithvi"}