diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html')
| -rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html index 397ad9724b..e86e8064c2 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html @@ -9,24 +9,24 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/abs <p><math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.abs</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><mrow><mo stretchy="false">|</mo><mi>x</mi><mo stretchy="false">|</mo></mrow><mo>=</mo><mrow><mo>{</mo><mtable columnalign="left left"><mtr><mtd><mi>x</mi></mtd><mtd><mtext>if</mtext><mspace width="1em"></mspace><mi>x</mi><mo>≥</mo><mn>0</mn></mtd></mtr><mtr><mtd><mo>-</mo><mi>x</mi></mtd><mtd><mtext>if</mtext><mspace width="1em"></mspace><mi>x</mi><mo><</mo><mn>0</mn></mtd></mtr></mtable></mrow></mrow><annotation encoding="TeX">{\mathtt{\operatorname{Math.abs}(x)}} = {|x|} = \begin{cases} x & \text{if} \quad x \geq 0 \\ -x & \text{if} \quad x < 0 \end{cases} </annotation></semantics></math></p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox">Math.abs(<em>x</em>);</pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>x</code></dt> <dd>一个数值</dd> </dl> -<h2 id="Description" name="Description">说明</h2> +<h2 id="Description">说明</h2> <p><code>由于 Math.abs()</code> <code>是</code> <code>Math</code> 中的一个静态方法,你应该通过 <code>Math.abs()</code> <code>调用。</code>(Math 不是构造器)</p> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> -<h3 id="Example:_Math.abs_behavior" name="Example:_Math.abs_behavior"><code>Math.abs()函数的行为</code></h3> +<h3 id="Example:_Math.abs_behavior"><code>Math.abs()函数的行为</code></h3> <p>传入一个非数字形式的字符串或者 undefined/empty 变量,将返回 <code>NaN</code>。传入 null 将返回 0。</p> @@ -115,7 +115,7 @@ Math.abs(); // NaN</pre> </table> </div> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>The {{jsxref("Global_Objects/Math", "Math")}} object it belongs to.</li> |
