Easy Tutorial
❮ Prop Doc Title Event Onreset ❯

JavaScript sqrt() Method

JavaScript Math Object

Example

Returns the square root of a number:

Output result:


Definition and Usage

The sqrt() method returns the square root of a number.


Browser Support

All major browsers support the sqrt() method.


Syntax

Parameter Values

Parameter Description
x Required. Must be a number greater than or equal to 0.

Return Value

Type Description
Number/NaN The square root of parameter x. If x is less than 0, it returns NaN.

Technical Details

| JavaScript Version: | 1.0 | | --- | --- |


More Examples

Example

In this example, we will return the square roots of different numbers:

a, b, c, d, and e Output result:


JavaScript Math Object

❮ Prop Doc Title Event Onreset ❯