JSFiddle - React, Tailwind, and code Playground
JavaScript
function Text(text) {
this.value = text;
this.trim = function() { /* trim code */ return new Text(this.value); }
this.bold = function() { /* bold code */ return new Text(this.value); }
}
var text = new Text('hello').trim().bold();
var text2 = new Text('hello2').trim().bold();
alert(text.value);