diff options
author | t7yang <t7yang@gmail.com> | 2022-01-10 08:38:06 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | ea514a38735125a2b5468300311ea8b2389c8863 (patch) | |
tree | 1afc6c2ff3ee3bc5efdfbba3841e2ef24f0c9485 /files/zh-cn/web/javascript/reference/global_objects/math | |
parent | a2960295605a27e084541fc2f93068dd3cad15ba (diff) | |
download | translated-content-ea514a38735125a2b5468300311ea8b2389c8863.tar.gz translated-content-ea514a38735125a2b5468300311ea8b2389c8863.tar.bz2 translated-content-ea514a38735125a2b5468300311ea8b2389c8863.zip |
remove hidden class for zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/math')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/math/index.html | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/index.html index 3064bc3893..ae08c53771 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/index.html @@ -127,40 +127,6 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math <dd>返回一个数的整数部分,直接去除其小数点及之后的部分。</dd> </dl> -<div class="hidden"> -<div class="note"> -<p>已被移除的内容:</p> -</div> - -<h2 id="拓展_Math_对象">拓展 <code>Math</code> 对象</h2> - -<p>As with most of the built-in objects in JavaScript, the <code>Math</code> object can be extended with custom properties and methods. To extend the <code>Math</code> object, you do not use <code>prototype</code>. Instead, you directly extend <code>Math</code>:</p> - -<pre>Math.propName = propValue; -Math.methodName = methodRef;</pre> - -<p>For instance, the following example adds a method to the <code>Math</code> object for calculating the <em>greatest common divisor</em> of a list of arguments.</p> - -<pre class="brush: js">/* Variadic function -- Returns the greatest common divisor of a list of arguments */ -Math.gcd = function() { - if (arguments.length == 2) { - if (arguments[1] == 0) - return arguments[0]; - else - return Math.gcd(arguments[1], arguments[0] % arguments[1]); - } else if (arguments.length > 2) { - var result = Math.gcd(arguments[0], arguments[1]); - for (var i = 2; i < arguments.length; i++) - result = Math.gcd(result, arguments[i]); - return result; - } -};</pre> - -<p>试试运行下面的代码:</p> - -<pre class="brush: js">console.log(Math.gcd(20, 30, 15, 70, 40)); // `5`</pre> -</div> - <h2 id="规范">规范</h2> <table class="standard-table"> |