string String.prototype.trim()
Remove whitespace from the front and back of the string. Whitespace includes the characters in the production WhiteSpace and LineTerminator (so spaces, tabs, returns and some more exotic characters like BOM).
The this value is coerced to a string.
String.prototype.trim = function(){
CheckObjectCoercible(this);
var S = ToString(this);
// todo: explicitly check for those characters
var T = S.trim();
return T;
}