JavaScript Demo: Object.prototype.toString()

function Dog(name) {
this.name = name;
}

const dog1 = new Dog('Gabby');

Dog.prototype.toString = function dogToString() {
return `${this.name}`;
};

console.log(dog1.toString());
// Expected output: "Gabby"