Skip to content

concat

The concat() function merges multiple arrays into a new continuous array.

Interactive example

Syntax

Classic signature

typescript
function concat<
	GenericElement extends unknown
>(
	input: readonly GenericElement[],
	elements: readonly GenericElement[],
	...elementsRest: readonly GenericElement[][]
): GenericElement[]

Curried signature

typescript
function concat<
	GenericElement extends unknown
>(
	elements: readonly GenericElement[]
): (input: readonly GenericElement[]) => GenericElement[]

Parameters

  • input: Base array.
  • elements, ...elementsRest: Additional arrays to chain together.

Return value

A new array containing all elements in the order the arrays were provided.

See also

Sources

Released under the MIT license.