Skip to content

prepend

The prepend() function adds one or more prefix strings before an input string and returns a new string.

Interactive example

Syntax

Classic signature

typescript
function prepend(
	input: string,
	...textsRest: string[]
): string

Curried signature

typescript
function prepend(
	text: string
): (input: string) => string

Parameters

  • input: The base string.
  • text: Prefix used in curried mode.
  • textsRest: One or more prefix strings to place before input.

Return value

A new string built by concatenating all prefixes before the input string.

See also

  • concat - Concatenates one or more strings after an input
  • pop - Removes the last character of a string

Released under the MIT license.