Math.SQRT1_2

JavaScript 1.0+, ECMAScript 1.0+, JScript 1.0+ Nav2+, NES2+, IE 3+, Opera3+ Syntax

							math.SQRT1_2

Description

The SQRT1_2 property of the Math object returns the square root of one half, which is approximately 0.707.

Example

Listing 6.174 shows how SQRT1_2 can be used. The function, doMath, returns the square root of 1/2 to the text box on the page.

Listing 6.174 Example of the SQRT1_2 Property
 <html> <body> <script language="JavaScript"> <!–– Hide // function returns the square root of 1/2 function doMath(){ var result = Math.SQRT1_2; document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> The square root of 1/2 is: <input type="text" name="answer" size=20> <input type="button" value="Calculate" ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.