Skip to content

sqrt

The sqrt() method returns the square root of a number. The square root of a number x is the value y such that y² = x.

Interactive example

Syntax

typescript
function sqrt<
	GenericInput extends number
>(
	input: GenericInput
): number

Parameters

  • input: The number for which to compute the square root.

Return value

The square root of the given number. If the number is negative, returns NaN.

See also

  • power - Raises a number to a power
  • abs - Returns the absolute value of a number

Sources

Released under the MIT license.