JavaScript squareRoot
Math.sqrt() returns the square root of a number. Passing a negative value returns NaN.
Syntax
Math.sqrt(num) Examples
| Input | Arguments | Output |
|---|---|---|
| 9 | — | 3 |
Gotchas
- Math.sqrt of a negative number is NaN.
Try it live
Type your input and see squareRoot transform it instantly.
Want to go further? Chain squareRoot with other functions in the visual Playground — pipe one output into the next and watch your data transform.