From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../global_objects/array/isarray/index.html | 142 +++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 files/nl/web/javascript/reference/global_objects/array/isarray/index.html (limited to 'files/nl/web/javascript/reference/global_objects/array/isarray') diff --git a/files/nl/web/javascript/reference/global_objects/array/isarray/index.html b/files/nl/web/javascript/reference/global_objects/array/isarray/index.html new file mode 100644 index 0000000000..19566a4ced --- /dev/null +++ b/files/nl/web/javascript/reference/global_objects/array/isarray/index.html @@ -0,0 +1,142 @@ +--- +title: Array.isArray() +slug: Web/JavaScript/Reference/Global_Objects/Array/isArray +translation_of: Web/JavaScript/Reference/Global_Objects/Array/isArray +--- +
{{JSRef}}
+ +

De Array.isArray() bepaalt of de gegeven waarde een {{jsxref("Array")}} is. 

+ +

Syntax

+ +
Array.isArray(obj)
+ +

Parameters

+ +
+
obj
+
Het te onderzoeken object.
+
+ +

Beschrijving

+ +

Indien het object een {{jsxref("Array")}} is, dan is true het resultaat, anders wordt dit false

+ +

Bekijk het artikel “Determining with absolute accuracy whether or not a JavaScript object is an array” voor nadere details.

+ +

Voorbeelden

+ +
// alle van de volgende call resulteren in true
+Array.isArray([]);
+Array.isArray([1]);
+Array.isArray(new Array());
+// Weinig bekend: Array.prototype is zelf een array:
+Array.isArray(Array.prototype);
+
+// alle van de volgende calls resulteren in 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

+ +

De volgende code zal de methode Array.isArray() aanmaken indien deze niet van huis uit werd meegegeven:

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

Specificaties

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpecificatiesStatusCommentaar
{{SpecName('ES5.1', '#sec-15.4.3.2', 'Array.isArray')}}{{Spec2('ES5.1')}}Initiele definitie. Geimplementeerd in JavaScript 1.8.5.
{{SpecName('ES6', '#sec-array.isarray', 'Array.isArray')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-array.isarray', 'Array.isArray')}}{{Spec2('ESDraft')}} 
+ +

Browser compatibiliteit

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
EigenschapChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome("5")}}{{CompatGeckoDesktop("2.0")}}{{CompatIE("9")}}{{CompatOpera("10.5")}}{{CompatSafari("5")}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
EigenschapAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("2.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Zie ook

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