javascript sqrt() method


  Translation results:

[Calculation]= SQuare Root, square root

javascript sqrt() methodsyntax

Function: Returns the square root of a number.

Syntax: Math.sqrt(x)

Parameters: x Required. Must be a number greater than or equal to 0.​

Returns: The square root of parameter x. If x is less than 0, NaN is returned.

javascript sqrt() methodexample

<html>
<body>

<script type="text/javascript">

    document.write(Math.sqrt(0) + "<br />")
    document.write(Math.sqrt(1) + "<br />")
    document.write(Math.sqrt(9) + "<br />")
    document.write(Math.sqrt(0.64) + "<br />")
    document.write(Math.sqrt(-9))

</script>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A