# Using Math sqrt() function to coding in Javascript/JS

This JavaScript tutorial explains how to use the math characteristic known as sqrt() with syntax and examples.

## Description

In JavaScript, sqrt() is a function that is used to return the rectangular root of a number. Because the sqrt() characteristic is a static feature of the Math object, it need to be invoked through the placeholder object referred to as Math.

## Syntax

In JavaScript, the syntax for the sqrt() characteristic is:

``Math.sqrt(number);``

Parameters or Arguments

number The wide variety used to calculate the rectangular root. The quantity should no longer be a cost that is larger than or equal to zero

## Returns

The sqrt() feature returns the rectangular root of a number.

If the range is a terrible number, the sqrt() function will return NaN.

## Note

Math is a placeholder object that contains mathematical features and constants of which sqrt() is one of these functions.

## Example

Let’s take a seem to be at an instance of how to use the sqrt() function in JavaScript.

For example:

``````console.log(Math.sqrt(25));
console.log(Math.sqrt(3));
console.log(Math.sqrt(-9));``````

In this example, we have invoked the sqrt() function the usage of the Math class.

We have written the output of the sqrt() feature to the internet browser console log, for demonstration purposes, to exhibit what the sqrt() feature returns.

The following will be output to the net browser console log:

``````5
1.7320508075688772
NaN``````

In this example, the first output to the console log lower back 5 which is the rectangular root of 25.

The 2nd output to the console log back 1.7320508075688772 which is the square root of 3

The 0.33 output to the console log again NaN because the price -9 is a bad number.