This article needs an editorial review. How you can help.
This translation is incomplete. Please help translate this article from English.
Array.isArray() metodu değerin Array olup olmadığını kontrol eder.
Syntax
Array.isArray(obj)
Paranetreler
obj- Kontrol edilecek nesne.
Açıklamalar
Nesne eğer Array ise, true döndürür, değil ise false..
Daha fazla detay için makaleye göz atın: “Determining with absolute accuracy whether or not a JavaScript object is an array”
Örnekler
// Aşağıdaki tüm örnekler true döndürür
Array.isArray([]);
Array.isArray([1]);
Array.isArray(new Array());
// Little known fact: Array.prototype itself is an array:
Array.isArray(Array.prototype);
// Aşağıdaki tüm örnekler false döndürür
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 });
Kod Parçası
Eğer orijinal olarak mevcut değil ise, aşağıdaki kodu daha önce herhangi bir kod yaratılmadan çalıştırılır.
if (!Array.isArray) {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
Tanımlama
| Tanımlama | Durum | Açıklama |
|---|---|---|
| ECMAScript 5.1 (ECMA-262) The definition of 'Array.isArray' in that specification. |
Standard | İlk tanım. JavaScript 1.8.5 sürümünde uygulamaya koyuldu. |
| 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 |
Tarayıcı bağdaşması
| Özellik | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Temel Destek | 5 | 4.0 (2.0) | 9 | 10.5 | 5 |
| Özellik | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | ||
|---|---|---|---|---|---|---|---|---|
|
(Yes) | (Yes) | 4.0 (2.0) | (Yes) | (Yes) | (Yes) |