From 48775b07d0867f298e78553cde9b5fbafc03549f Mon Sep 17 00:00:00 2001 From: Tomoyuki Hata <7702653+hata6502@users.noreply.github.com> Date: Tue, 25 Jan 2022 11:36:09 +0900 Subject: Fix Math.max() initial value to -Infinity --- files/de/web/javascript/reference/global_objects/math/max/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/de/web/javascript/reference/global_objects') diff --git a/files/de/web/javascript/reference/global_objects/math/max/index.html b/files/de/web/javascript/reference/global_objects/math/max/index.html index 426bf6abad..15d0981aa1 100644 --- a/files/de/web/javascript/reference/global_objects/math/max/index.html +++ b/files/de/web/javascript/reference/global_objects/math/max/index.html @@ -55,7 +55,7 @@ Math.max(-10, 20); // 20
var arr = [1, 2, 3]; var max = arr.reduce(function(a, b) { return Math.max(a, b); -}); +}, -Infinity);
Die folgende Funktion benutzt {{jsxref("Function.prototype.apply()")}}, um den maximalen Wert eines numerischen Arrays zu finden. getMaxOfArray([1, 2, 3])
entspricht Math.max(1, 2, 3)
, aber getMaxOfArray()
kann programmatisch erstellte Arrays jeder Art annehmen.