freeCodeCamp/guide/russian/javascript/standard-objects/math/math-sqrt/index.md

29 lines
845 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
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)