Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

()Array.isArray

This translation is incomplete. Please help translate this article from English.

الـ ()Array.isArray تفحص القيمة الممررة لها، هل هي كائن من نوع Array أم ﻻ.

صيغة الكتابة

Array.isArray(obj)

المعاملات

obj
الكائن الذي سيتم فحصه.

القيمة العائدة

إذا كان كائن من نوع Array تكون true وإلا تكون false.

الوصف

إذا كان الكائن من نوع Array ترجع true وإلا ترجع false.

لمزيد من التفاصيل، إقرأ هذا المقال “Determining with absolute accuracy whether or not a JavaScript object is an array” .

أمثلة

//true جميع الأمثلة التالية ترجع
Array.isArray([]);
Array.isArray([1]);
Array.isArray(new Array());
//هي نفسها مصفوفة Array.prototype حقيقة معروفة أن 
Array.isArray(Array.prototype); 

//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

Running the following code before any other code will create Array.isArray() if it's not natively available.

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

المواصفات

Specification Status Comment
ECMAScript 5.1 (ECMA-262)
The definition of 'Array.isArray' in that specification.
Standard Initial definition. Implemented in JavaScript 1.8.5.
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'Array.isArray' in that specification.
Standard  
ECMAScript 2017 Draft (ECMA-262)
The definition of 'Array.isArray' in that specification.
Draft  

التكامل مع المتصفحات

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 5 4.0 (2.0) 9 10.5 5
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) 4.0 (2.0) (Yes) (Yes) (Yes)

إقرأ أيضا

Document Tags and Contributors

 Contributors to this page: DevOsamaMohamed
 Last updated by: DevOsamaMohamed,