aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br
diff options
context:
space:
mode:
authorTomoyuki Hata <7702653+hata6502@users.noreply.github.com>2022-01-25 11:36:09 +0900
committerIrvin <irvinfly@gmail.com>2022-02-16 00:04:17 +0800
commit48775b07d0867f298e78553cde9b5fbafc03549f (patch)
tree615454d3b26b989444b45aa2324d14d959f9662f /files/pt-br
parent76c2fdbe9ccc65244df60929fa17bce3ebc70117 (diff)
downloadtranslated-content-48775b07d0867f298e78553cde9b5fbafc03549f.tar.gz
translated-content-48775b07d0867f298e78553cde9b5fbafc03549f.tar.bz2
translated-content-48775b07d0867f298e78553cde9b5fbafc03549f.zip
Fix Math.max() initial value to -Infinity
Diffstat (limited to 'files/pt-br')
-rw-r--r--files/pt-br/web/javascript/reference/global_objects/math/max/index.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/math/max/index.html b/files/pt-br/web/javascript/reference/global_objects/math/max/index.html
index b28723014f..b294467920 100644
--- a/files/pt-br/web/javascript/reference/global_objects/math/max/index.html
+++ b/files/pt-br/web/javascript/reference/global_objects/math/max/index.html
@@ -52,7 +52,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);
-});</pre>
+}, -Infinity);</pre>
<p>A função a seguir utiliza {{jsxref("Function.prototype.apply()")}} para encontrar o elemento de maior valor dentro do array. <code>getMaxOfArray([1,2,3])</code> é equivalente a <code>Math.max(1, 2, 3)</code>, mas você pode usar <code>getMaxOfArray</code>  em arrays construídos programaticamente e o ideal é utilizá-la somente em arrays com relativamente poucos elementos.</p>