Math.sqrt()

Category:Math

Takes the square root of x.

There are some math calculations that require you to take the square root. Math.sqrt(x) does not change the value of x, rather it returns the the square root of x.

Examples

var t = Math.sqrt(16); console.log(t);


Syntax

Math.sqrt(x);

Parameters

NameTypeRequired?Description
x Number A number to take the square root of

Returns

A number that is the square root of x

Found a bug in the documentation? Let us know at documentation@code.org