Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the Math.sin() method doc #23584

Merged
merged 6 commits into from
Sep 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
jasonren0403 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
title: Math.sin()
slug: Web/JavaScript/Reference/Global_Objects/Math/sin
page-type: javascript-static-method
browser-compat: javascript.builtins.Math.sin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mdn-linter] reported by reviewdog 🐶

Suggested change
page-type: javascript-static-method
browser-compat: javascript.builtins.Math.sin

---

{{JSRef}}

## 概述

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 概述

**`Math.sin()`** 函数返回一个数值的正弦值。
**`Math.sin()`** 静态方法返回一个弧度的正弦值。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**`Math.sin()`** 静态方法返回一个弧度的正弦值
**`Math.sin()`** 静态方法以弧度为单位返回一个数字的正弦值


{{EmbedInteractiveExample("pages/js/math-sin.html")}}

## 语法

```plain
```js-nolint
Math.sin(x)
```

Expand All @@ -22,19 +26,21 @@ Math.sin(x)

## 描述
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 描述
### 返回值


`sin` 方法返回一个 -1 到 1 之间的数值,表示给定角度(单位:弧度)的正弦值
`x` 的正弦值,介于 -1 到 1 之间(包含 -1 和 1)。如果 `x` 为 {{jsxref("Infinity")}}、`-Infinity` 或 {{jsxref("NaN")}},则返回 {{jsxref("NaN")}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`x` 的正弦值,介于 -1 到 1 之间(包含 -1 和 1)。如果 `x` 为 {{jsxref("Infinity")}}、`-Infinity` 或 {{jsxref("NaN")}},则返回 {{jsxref("NaN")}}。
`x` 的正弦值,介于 -1 到 1 之间(包含 -1 和 1)。如果 `x` 为 {{jsxref("Infinity")}}、`-Infinity` 或 {{jsxref("NaN")}}则返回 {{jsxref("NaN")}}。


jasonren0403 marked this conversation as resolved.
Show resolved Hide resolved
由于 `sin` 是 `Math` 的静态方法,所以应该像这样使用:`Math.sin()`,而不是作为你创建的 `Math` 实例的方法。
由于 `sin` 是 `Math` 的静态方法,所以应该像这样使用:`Math.sin()`,而不是作为你创建的 `Math` 实例的方法(`Math` 不是构造函数)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
由于 `sin``Math` 的静态方法,所以应该像这样使用:`Math.sin()`,而不是作为你创建的 `Math` 实例的方法`Math` 不是构造函数)。
由于 `sin()``Math` 的静态方法,应该总是以 `Math.sin()` 的形式,而不是作为 `Math` 对象的方法来使用它`Math` 不是构造函数)。


## 示例

### 示例:使用 `Math.sin`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### 示例:使用 `Math.sin`
### 使用 Math.sin()


```js
Math.sin(-Infinity); // NaN
Math.sin(-0); // -0
Math.sin(0); // 0
Math.sin(1); // 0.8414709848078965

Math.sin(Math.PI / 2); // 1
Math.sin(Infinity); // NaN
```

## 规范
Expand Down
Loading