How to use Math SQRT2 Property in JavaScript

In this article, I will explain use of Math SQRT2 Property in JavaScript.
  • 1303

JavaScript SQRT2 Property

  • SQRT2 property of math object returns the square root of 2 which is approximately 1.414.

Syntax

Math.SQRT2

Example

The following example is show to use of SQRT2 property in javascript.

<!DOCTYPE html>

<html>

<body>

<h3>SQRT2 Property Example</h3>

<p id="demo" style=" background-color:Silver">Click the button to display the square root of 2</p>

<button onclick="myFunction()">Click On</button>

<script type="text/javascript">

    function myFunction() {

        document.getElementById("demo").innerHTML = Math.SQRT2;

    }

</script>

</body>

</html>

Output1

SQRT 2 output.jpg

Output2

SQRT 2 Final.jpg

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2013 dotNetheaven. All rights reserved.