# The String trim() method

> Learn how the JavaScript trim() method returns a new string with the white space removed from the beginning and the end, leaving the original string untouched.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2019-03-09 | Topics: [JavaScript](https://flaviocopes.com/tags/js/) | Canonical: https://flaviocopes.com/javascript-string-trim/

Return a new string with removed white space from the beginning and the end of the original string

```js
'Testing'.trim() //'Testing'
' Testing'.trim() //'Testing'
' Testing '.trim() //'Testing'
'Testing '.trim() //'Testing'
```
