JavaScript Math.sqrt()
Examples
let x = Math.sqrt(9);
Try it Yourself »
let a = Math.sqrt(0);
let b = Math.sqrt(1);
let c = Math.sqrt(9);
let d = Math.sqrt(64);
let e = Math.sqrt(-9);
Try it Yourself »
Description
The Math.sqrt()
method returns the square root of a number.
Syntax
Math.sqrt(x)
Parameters
Parameter | Description |
x | Required. A number. |
Return Value
Type | Description |
Number | The square root of the number.NaN if the number negative. |
Browser Support
Math.
is an ECMAScript1 (JavaScriopt 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |