Skip to content

add

The add() method adds two numbers or creates a partially applied addition function. It can be used in a curried way to ease functional composition.

Interactive example

Syntax

Classic signature

typescript
function add<
	GenericInput extends number
>(
	input: GenericInput,
	operand: number
): number

Curried signature

typescript
function add<
	GenericInput extends number
>(
	operand: number
): (input: GenericInput) => number

Parameters

  • input: The base number to which the operand is added (classic signature only).
  • operand: The number to add to the value.

Return value

returns the sum of the two numbers (input + operand).

See also

Sources

Released under the MIT license.