Skip to content

trimEnd ​

The trimEnd() method removes whitespace at the end of a string. Whitespace includes spaces, tabs, line breaks, and other Unicode whitespace characters.

Interactive example ​

Syntax ​

typescript
function trimEnd<
	GenericInput extends string
>(input: GenericInput): string

Parameters ​

  • input: The string from which to remove trailing whitespace.

Return value ​

A new string representing the calling string without trailing whitespace.

See also ​

  • trim - Removes whitespace at the start and end
  • trimStart - Removes whitespace at the start only

Sources ​

Released under the MIT license.