Standard built-ins
Math.sqrt()
Nonnegative square root of a nonnegative Number; negative inputs except -0 produce NaN, and -0 stays -0. Converts x to Number; BigInt conversion throws TypeError.
Formal Syntax & Structure
javascript syntaxjavascript
Math.sqrt(x)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | number | Number input or value coercible to Number. |
Return Value
number
Result of the numerical operation, possibly NaN.
Working Example
Example Snippetjavascript
console.log(Math.sqrt(49),Number.isNaN(Math.sqrt(-1)));