May 2011
Intermediate to advanced
1096 pages
40h 54m
English
Math.sqrt() — compute a square root
Math.sqrt(x)
xA numeric value greater than or equal to zero.
The square root of x. Returns
NaN if
x is less than zero.
Math.sqrt() computes the
square root of a number. Note, however, that you can compute
arbitrary roots of a number with Math.pow(). For example:
Math.cuberoot=function(x){returnMath.pow(x,1/3);}Math.cuberoot(8);// Returns 2
Read now
Unlock full access