String trimStart() and trimEnd()
Widely available
The trimStart()
and trimEnd()
methods of strings return a new string with whitespace removed from the beginning or end of the string.
To learn more, see
String.prototype.trimEnd(),
String.prototype.trimStart() at MDN.
Compatibility
- Chrome 66 Released on 2018-04-17
- Chrome Android 66 Released on 2018-04-17
- Edge 79 Released on 2020-01-15
- Firefox 61 Released on 2018-06-26
- Firefox for Android 61 Released on 2018-06-26
- Safari 12 Released on 2018-09-17
- Safari on iOS 12 Released on 2018-09-17
Specifications
- ECMAScript Language Specification (#sec-string-objects), from TC39 (Ecma International).