Math.sqrt(value) Last updated: 24. Jan 2023
Calculates and returns the square root of a number.
Parameters
Name | Type | Description |
---|---|---|
value | number | Number to calculate square root of. |
Returns
A number, the square root of specified value.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.write(Math.sqrt(64));
write("\n");
/* Expected output: 8 */
write(Math.sqrt(256));
write("\n");
/* Expected output: 16 */
write(Math.sqrt(1000));
/* Expected output: 31.622776601683793 */
Output
The JS code above produces the output shown below:8
16
31.622776601683793