29 lines
845 B
Markdown
29 lines
845 B
Markdown
---
|
||
title: Math Sqrt
|
||
localeTitle: Math Sqrt
|
||
---
|
||
## Math Sqrt
|
||
|
||
Функция `Math.sqrt()` возвращает квадратный корень из числа.
|
||
|
||
Если введено отрицательное число, возвращается `NaN` .
|
||
|
||
`sqrt()` является статическим методом `Math` , поэтому он всегда называется `Math.sqrt()` а не как метод для другого объекта.
|
||
|
||
#### Синтаксис
|
||
|
||
`Math.sqrt(x)` , где `x` - число.
|
||
|
||
#### Примеры
|
||
|
||
```js
|
||
Math.sqrt(25); // 5
|
||
Math.sqrt(169); // 13
|
||
Math.sqrt(3); // 1.732050807568
|
||
Math.sqrt(1); // 1
|
||
Math.sqrt(-5); // NaN
|
||
```
|
||
|
||
#### Дополнительная информация:
|
||
|
||
[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt) |