Skip to content

trimStart ​

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

Interactive example ​

Syntax ​

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

Parameters ​

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

Return value ​

A new string representing the calling string without leading whitespace.

See also ​

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

Sources ​

Released under the MIT license.