JavaScript String trimEnd()
Definition and Usage
The trimEnd()
method removes whitespace from the end of a string.
The trimEnd()
method does not change the original string.
The trimEnd()
method works like trim()
, but removes whitespace only from the end of a string.
Note
The trimEnd()
method was added to JavaScript in ECMAScript 2019.
See Also:
Syntax
string.trimEnd()
Parameters
NONE |
Return Value
Type | Description |
A string | A string with removed whitespace from the end of the string. |
JavaScript String trimEnd()
is supported in all browsers since January 2020:
Chrome 66 | Edge 79 | Firefox 61 | Safari 12 | Opera 50 |
Apr 2018 | Jan 2020 | Jun 2018 | Sep 2018 | May 2018 |