Skip to content

pop ​

The pop() function removes the last character from a string and returns a new string.

Interactive example ​

Syntax ​

typescript
function pop<
	GenericInput extends string
>(
	input: GenericInput
): Pop<GenericInput>

Parameters ​

  • input: String from which to remove the last character.

Return value ​

A new string without its last character. Literal types are preserved when possible.

See also ​

  • shift - Removes the first character of a string
  • prepend - Adds prefix strings before the input

Released under the MIT license.