Files
freeCodeCamp/guide/chinese/javascript/standard-objects/math/index.md
2018-10-16 21:32:40 +05:30

23 lines
686 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Math
localeTitle: 数学
---
## 数学
`Math`是JavaScript的标准内置对象包含数学常量和函数作为属性和方法。最值得注意的是它包含常量π和Euler常量以及诸如`floor()` `round()` `ceil()`等函数。
### 例
以下示例显示如何使用`Math`对象编写计算圆的面积的函数:
```javascript
function calculateCircleArea(radius) {
return Math.PI * Math.pow(radius, 2);
}
calculateCircleArea(1); // 3.141592653589793
```
### 其他资源
* [MDN网络文档](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math)
* [W3Schools的](https://www.w3schools.com/js/js_math.asp)