From 95aca4b4d8fa62815d4bd412fff1a364f842814a Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Thu, 29 Apr 2021 16:16:42 -0700 Subject: remove retired locales (#699) --- .../reference/global_objects/math/max/index.html | 135 --------------------- 1 file changed, 135 deletions(-) delete mode 100644 files/ca/web/javascript/reference/global_objects/math/max/index.html (limited to 'files/ca/web/javascript/reference/global_objects/math/max') diff --git a/files/ca/web/javascript/reference/global_objects/math/max/index.html b/files/ca/web/javascript/reference/global_objects/math/max/index.html deleted file mode 100644 index 1b556be585..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/max/index.html +++ /dev/null @@ -1,135 +0,0 @@ ---- -title: Math.max() -slug: Web/JavaScript/Reference/Global_Objects/Math/max -translation_of: Web/JavaScript/Reference/Global_Objects/Math/max -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/max ---- -
{{JSRef}}
- -

La funció Math.max() retorna el nombre més gran de zero o més nombres.

- -

Sintaxi

- -
Math.max([valor1[, valor2[, ...]]])
- -

Paràmetres

- -
-
valor1, valor2, ...
-
Nombres.
-
- -

Descripció

- -

Com que max() és un mètode estàtic de Math, sempre s'utilitza com Math.max() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Si no es proporciona cap argument, el resultat és -{{jsxref("Infinity")}}.

- -

Si al menys un dels arguments no pot convertir-se a un nombre, el resultat és {{jsxref("NaN")}}.

- -

Exemples

- -

Utilitzar Math.max()

- -
Math.max(10, 20);   //  20
-Math.max(-10, -20); // -10
-Math.max(-10, 20);  //  20
-
- -

La següent funció utilitza {{jsxref("Function.prototype.apply()")}} per a trobar l'element màxim d'un array numèric. getMaxOfArray([1, 2, 3]) és equivalent a Math.max(1, 2, 3), però getMaxOfArray() pot emprar-se en arrays de qualsevol mida construits programàticament.

- -
function getMaxOfArray(numArray) {
-  return Math.max.apply(null, numArray);
-}
-
- -

O bé amb el nou {{jsxref("Operators/Spread_operator", "operador spread")}}, obtenir el nombre màxim d'un array és molt més simple.

- -
var arr = [1, 2, 3];
-var max = Math.max(...arr);
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.11', 'Math.max')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.max', 'Math.max')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - -- cgit v1.2.3-54-g00ecf