Math SQRT2 Property - Javascript Math

Javascript examples for Math:SQRT2

Description

The SQRT2 property returns the square root of 2, approximately 1.414.

Return Value:

A Number, representing the square root of 2

The following code shows how to return the square root of 2:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from   w ww  .j ava  2  s.c om*/
    document.getElementById("demo").innerHTML = Math.SQRT2;
}
</script>

</body>
</html>

Related Tutorials