JSFiddle - React, Tailwind, and code Playground
by Addy Osmani
JavaScript
String.prototype.trim = function()
{
var b=0,e=this.length -1;
while(this.substr(b,1) == " ") b++;
while(this.substr(e,1) == " ") e--;
alert('custom trim used');
return this.substring(b,e+1);
}
var s = new String(" Hello ");
s=s.trim();
alert("!" + s + "!");