From cb9e359a51c3249d8f5157db69d43fd413ddeda6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:45:12 +0100 Subject: unslug ca: move --- .../number/positive_infinity/index.html | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 files/ca/web/javascript/reference/global_objects/number/positive_infinity/index.html (limited to 'files/ca/web/javascript/reference/global_objects/number/positive_infinity') diff --git a/files/ca/web/javascript/reference/global_objects/number/positive_infinity/index.html b/files/ca/web/javascript/reference/global_objects/number/positive_infinity/index.html new file mode 100644 index 0000000000..234a779fd1 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/number/positive_infinity/index.html @@ -0,0 +1,137 @@ +--- +title: Number.POSITIVE_INFINITY +slug: Web/JavaScript/Referencia/Objectes_globals/Number/POSITIVE_INFINITY +translation_of: Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY +--- +
{{JSRef}}
+ +

La propietat Number.POSITIVE_INFINITY representa el valor infinit negatiu.

+ +

No fa falta crear un objecte {{jsxref("Global_Objects/Number", "Number")}} per accedir a aquesta propietat estàtica (feu servir Number.POSITIVE_INFINITY).

+ +
{{js_property_attributes(0, 0, 0)}}
+ +

Descripció

+ +

El valor de Number.POSITIVE_INFINITY és el mateix que el valor negatiu de la propietat de l'objecte global {{jsxref("Infinity")}}.

+ +

 

+ +

Aquest valor es comporta de forma una mica diferent a l'infinit matemàtic:

+ +

Qualsevol valor positiu, incloent POSITIVE_INFINITY, multiplicat per POSITIVE_INFINITY és POSITIVE_INFINITY.

+ + + +

Es pot fer serivir la propietat Number.POSITIVE_INFINITY per indicar una condició d'error que retorna un nombre finit en cas d'èxit. Fixeu-vos, però, que {{jsxref("isFinite")}} seria més apropiat en aquest cas.

+ +

Exemples

+ +

Utilitzar POSITIVE_INFINITY

+ +

In the following example, the variable bigNumber is assigned a value that is larger than the maximum value. When the {{jsxref("Statements/if...else", "if")}} statement executes, bigNumber has the value Infinity, so bigNumber is set to a more manageable value before continuing.

+ +

A l'exemple següent, a la variable nombrePetit se li assigna un valor que és més gran que el valor màxim. Quan la declaració {{jsxref("Statements/if...else", "if")}} s'executa, nombrePetit té el valor Infinity, així nombrePetit s'estableix com a un valor més manegable abans de prosseguir.

+ +
var nombrePetit = Number.MAX_VALUE * 2;
+
+if (nombrePetit == Number.POSITIVE_INFINITY) {
+  nombrePetit= returnFinite();
+}
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.7.3.6', 'Number.POSITIVE_INFINITY')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-number.positive_infinity', 'Number.POSITIVE_INFINITY')}}{{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