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 »
The Math.sqrt()
method returns the square root of a number.
Math.sqrt(
x)
Parameter | Description |
x | Required. A number. |
Type | Description |
Number | The square root of the number.NaN if the number negative. |
Math.
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!