Math.sqrt

sqrt — Returns the square root of a number.

Description

Math.sqrt(number number)

Parameters

Name Description Type Default Optional
number number No

Examples

Example #1 – sqrt example
console.log(Math.sqrt(4)); // 2 console.log(Math.sqrt(0)); // 0 console.log(Math.sqrt(-3)); // NaN console.log(Math.sqrt('2')); // 1.4142135623730951

External references