String trimStart() and trimEnd()
Widely available since 2022-07-15
The trimStart()
and trimEnd()
methods of strings return a new string with whitespace removed from the beginning or end of the string.
Learning resources on MDN
Browser support
- 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).