JSFiddle - React, Tailwind, and code Playground
by wwwroot
JavaScript
/* Prototype pattern */
var ViewModel = function(tax) {
this._tax = tax;
};
ViewModel.prototype = {
_addTax: function (net) {
return net + net * this._tax;
},
printPrice: function (price) {
console.log(this._addTax(price));
}
}
new ViewModel(0.2).printPrice(1000);