Math.sqrt()
The Math.sqrt()
function returns the square root of a number.
Syntax
Math.sqrt(x)
Parameters
x
- : A number greater than or equal to 0.
Return value
The square root of x
, a nonnegative number. If x < 0
, returns NaN
.
Description
Because sqrt()
is a static method of Math
, you always use it as Math.sqrt()
, rather than as a method of a Math
object you created (Math
is not a constructor).