Skip to content

minOf

The minOf() function returns the smallest numeric value of an array without modifying it. It accepts both classic arrays and immutable tuples.

Interactive example

Syntax

typescript
function minOf<
	GenericInput extends readonly number[]
>(
	input: GenericArray
): number | undefined

Parameters

  • input: Array of numbers to analyze.

Return value

The smallest number present in input, or undefined if the array is empty.

See also

  • maxOf - Returns the maximum value of an array
  • reduce - Allows writing custom aggregations

Sources

Released under the MIT license.