JSFiddle - React, Tailwind, and code Playground
by fristyr
JavaScript
function Animals() {
this.legs = true;
}
const animals = new Animals();
function Dogs() {
this.sayVoff = function() {
return 'Voff';
}
}
Dogs.prototype = animals;
const dogs = new Dogs();
function Dog(name) {
this.name = name;
}
Dog.prototype = dogs;
const niki = new Dog('niki');
console.log(animals.isPrototypeOf(dogs));
console.log(dogs.isPrototypeOf(niki));
console.log(niki.name);
console.log(niki.sayVoff());
console.log(niki.legs);