start page | rating of books | rating of authors | reviews | copyrights

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Math.sqrt() Function

Name

Math.sqrt() Function---compute a square root

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

Math.sqrt(x)

Arguments

x

Any numeric value or expression greater than or equal to zero.

Returns

The square root of x.

Description

Math.sqrt() returns the square root of its argument, which must be greater than or equal to zero.

Usage

You can compute roots other than the square root of a number with Math.pow(). For example:

function sq_rt(x)   { return Math.pow(x,1/2); }
function cube_rt(x) { return Math.pow(x,1/3); }

See Also

"Math", "Math.pow()"


Previous Home Next
Math.sin() Book Index Math.SQRT1_2

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell