sqrt Function

Top  Previous  Next

Return the square root of a number.

Syntax

Math.sqrt(number)

Arguments

numberA number.        

Return Value

A number, if the argument is positive; otherwise, NaN.

Examples

Math.sqrt(9);      // Returns 3

Math.sqrt(2);      // Returns 1.414214

Math.acos(-8);     // Returns NaN