diff options
Diffstat (limited to 'files/zh-tw/web')
-rw-r--r-- | files/zh-tw/web/javascript/reference/global_objects/math/max/index.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/max/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/max/index.html index d334c6bc02..a3e994c734 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/math/max/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/math/max/index.html @@ -55,7 +55,7 @@ Math.max(-10, 20); // 20 <pre class="brush: js">var arr = [1,2,3]; var max = arr.reduce(function(a, b) { return Math.max(a, b); -}); +}, -Infinity); </pre> <p>The following function uses {{jsxref("Function.prototype.apply()")}} to get the maximum of an array. <code>getMaxOfArray([1, 2, 3])</code> is equivalent to <code>Math.max(1, 2, 3)</code>, but you can use <code>getMaxOfArray()</code> on programmatically constructed arrays. This should only be used for arrays with relatively few elements.</p> |