JSFiddle - React, Tailwind, and code Playground
by Krishna Ananthi
JavaScript
const Car = function(c) {
this.color = c;
}
Car.prototype = {
getColor() {
return this.color;
}
}
const ToyCar = function() {}
ToyCar.prototype = Object.create(Car.prototype);
const legoCar = new ToyCar();
console.dir(legoCar instanceof ToyCar);
console.dir(legoCar instanceof Car);
console.dir(legoCar instanceof Object);
console.dir(ToyCar.prototype.isPrototypeOf(legoCar));
console.dir(Car.prototype.isPrototypeOf(legoCar));
console.dir(Object.prototype.isPrototypeOf(legoCar));