sqrt()

The sqrt() method is used to take the square root of the number (see syntax). As with all mathematical methods, it is used with the Math object.

syntax:

Math.sqrt(number)

EXAMPLE

document.write("The square root of 9 is " + Math.sqrt(9) );

The example shows a document.write statement which is used to write some applicable text to the screen along with the squre root of the number 9. The ouput should look as follows:



The square root of 9 is 3