Trim whitespace

suggest change

To remove whitespace from both ends of a string, use String.prototype.trim():

"    some whitespaced string  ".trim();  // "some whitespaced string"

Use trimStart() or trimEnd() to remove whitespace from only one end. trimLeft() and trimRight() are the same functions under older names.

"    this is me    ".trimStart();  // "this is me    "
"    this is me    ".trimEnd();    // "    this is me"

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents