Do you know what will be the output of this code?
JavaScript
function Dog() {}
Dog.prototype.bark = () => "woof";
const d = new Dog();
Dog.prototype.bark = () => "WOOF";
console.log(d.bark());
Show answer and explanation
The answer is "WOOF".
d doesn’t have its own bark. Each call looks it up on Dog.prototype, which by then holds the new function.