JSFiddle - React, Tailwind, and code Playground
JavaScript
var Horn = (function(){
var Horn = function (noise){
this.noise = noise;
this.sound = function(){
return "*blowing horn* " + this.noise;
}.bind(this);
};
return Horn; // is there a way to bind here?
})();
var h = new Horn('beep!')
var s = h.sound
console.log(s());