Do you know what will be the output of this code?
JavaScript
function Person(name) {
this.name = name;
return { name: "Other" };
}
console.log(new Person("Ana").name);
Show answer and explanation
The answer is "Other".
new creates this and returns it, unless the constructor explicitly returns an object. Then that object replaces this. Returning a primitive like 5 would be ignored.