ES2019 introduces String.prototype.trimStart() and String.prototype.trimEnd():
const string = ' hello world ';
string.trimStart();
string.trimEnd();
string.trim();
This functionality was previously available through the non-standard trimLeft() and trimRight() methods, which remain as aliases of the new methods for backward compatibility.
const string = ' hello world ';
string.trimStart();
string.trimLeft();
string.trimEnd();
string.trimRight();
string.trim();
String.prototype.trim{Start,End} support #