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 --- .../global_objects/array/isarray/index.html | 135 +++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 files/ca/web/javascript/reference/global_objects/array/isarray/index.html (limited to 'files/ca/web/javascript/reference/global_objects/array/isarray') diff --git a/files/ca/web/javascript/reference/global_objects/array/isarray/index.html b/files/ca/web/javascript/reference/global_objects/array/isarray/index.html new file mode 100644 index 0000000000..6393dde86f --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/array/isarray/index.html @@ -0,0 +1,135 @@ +--- +title: Array.isArray() +slug: Web/JavaScript/Referencia/Objectes_globals/Array/isArray +translation_of: Web/JavaScript/Reference/Global_Objects/Array/isArray +--- +
{{JSRef}}
+ +

El mètode Array.isArray()retorna true si un objecte és un array, o false en cas que no ho sigui.

+ +

Sintaxi

+ +
Array.isArray(obj)
+ +

Paràmetres

+ +
+
obj
+
L'objecte que s'ha de comprovar.
+
+ +

Descripció

+ +

Vegeu l'article “Determinar amb absoluta precisió si un objecte JavaScript és un array o no” per més detalls.

+ +

Exemples

+ +
// totes les crides següents retornen true
+Array.isArray([]);
+Array.isArray([1]);
+Array.isArray(new Array());
+// Fet poc conegut: Array.prototype és un array per si mateix:
+Array.isArray(Array.prototype);
+
+// totes les crides següents retornen false
+Array.isArray();
+Array.isArray({});
+Array.isArray(null);
+Array.isArray(undefined);
+Array.isArray(17);
+Array.isArray('Array');
+Array.isArray(true);
+Array.isArray(false);
+Array.isArray({ __proto__: Array.prototype });
+
+ +

Polyfill

+ +

Executar el codi següent abans de cap altre codi crearà Array.isArray() si no es troba disponible de forma nativa.

+ +
if (!Array.isArray) {
+  Array.isArray = function(arg) {
+    return Object.prototype.toString.call(arg) === '[object Array]';
+  };
+}
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES5.1', '#sec-15.4.3.2', 'Array.isArray')}}{{Spec2('ES5.1')}}Definició inicial. Implementat en JavaScript 1.8.5.
{{SpecName('ES6', '#sec-array.isarray', 'Array.isArray')}}{{Spec2('ES6')}} 
+ +

Compatibilitat amb navegadors

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("5")}}{{CompatGeckoDesktop("2.0")}}{{CompatIE("9")}}{{CompatOpera("10.5")}}{{CompatSafari("5")}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
CaracterísticaAndroidChrome per AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("2.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Vegeu també

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