Web features explorer

String trimLeft() and trimRight()

This feature is discouraged — TC39 recommends using trimStart() and trimEnd() instead. The trimLeft() and trimRight() aliases are provided for compatibility with old code.

Consider using String trimStart() and trimEnd() instead.

For more information, see: https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#String.prototype.trimleft

The trimLeft() and trimRight() methods of strings return a new string with whitespace removed from the beginning or end of the string. They're aliases for trimStart() and trimEnd().

Browser support

  • Chrome 4 Released on 2010-01-25
  • Chrome Android 18 Released on 2012-06-27
  • Edge 12 Released on 2015-07-29
  • Firefox 3.5 Released on 2009-06-30
  • Firefox for Android 4 Released on 2011-03-29
  • Safari 5 Released on 2010-06-07
  • Safari on iOS 4.2 Released on 2010-11-22