JSFiddle - React, Tailwind, and code Playground
JavaScript
function Car(name) {
this.name = name;
}
Car.prototype = {
drive: function () {
console.log('look, I am driving a ' + this.name);
},
honk: function () {
console.log("HONK!!! said the " + this.name);
}
}
var volvo = new Car('volvo'),
saab = new Car('saab');
saab.honk();
volvo.honk();
// HONK!!!