August 1999
Intermediate to advanced
1488 pages
72h 53m
English
math.SQRT2The SQRT2 property of the Math object returns the value of the square root of 2. This is approximately equal to 1.414.
Listing 6.175 shows how the SQRT2 property is used. The function, doMath, returns the square root of 2 to the text box on the page.
<html> <body> <script language="JavaScript"> <!–– Hide // function returns the square root of 2 function doMath(){ var result = Math.SQRT2; document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> The square root of 2 is: <input type="text" name="answer" size=20> <input type="button" value="Calculate" ... |
Read now
Unlock full access