JSFiddle - React, Tailwind, and code Playground
JavaScript
function Count() {
this.number = 0;
this.plus = (n) => {
this.number += n;
return this;
}
this.minus = (n) => {
this.number -= n;
return this;
}
this.result = () => this.number;
};
console.log(new Count().plus(1000).minus(512).plus(1000).result())