---
title: Array.isArray()
slug: Web/JavaScript/Reference/Global_Objects/Array/isArray
translation_of: Web/JavaScript/Reference/Global_Objects/Array/isArray
original_slug: Web/JavaScript/Referencje/Obiekty/Array/isArray
---
<div>{{JSRef("Global_Objects", "Array")}}</div>

<h2 id="Summary" name="Summary">Podsumowanie</h2>

<p><strong>Array.isArray()</strong> to metoda, która zwraca <code style="font-style: normal; line-height: 23.3333339691162px;">true</code><span style="line-height: 23.3333339691162px;"> </span> jeśli obiekt jest tablicą, fałsz jeśli nie jest.</p>

<h2 id="Syntax" name="Syntax">Składnia</h2>

<pre class="syntaxbox"><code>Array.isArray(<var>obj</var>)</code></pre>

<h3 id="Parameters" name="Parameters">Parametry</h3>

<dl>
 <dt><code>obj</code></dt>
 <dd>Obiekt do sprawdzenia</dd>
</dl>

<h2 id="Description" name="Description">Opis</h2>

<p>Zobacz artykuł  <a href="http://web.mit.edu/jwalden/www/isArray.html">“Determining with absolute accuracy whether or not a JavaScript object is an array”</a> , aby poznać więcej szczegółów.</p>

<h2 id="Examples" name="Examples">Przykłady</h2>

<pre class="brush: js">// poniższe przykłady zwrócą true
Array.isArray([]);
Array.isArray([1]);
Array.isArray(new Array());
// Mało znany fakt: Array.prototype sam w sobie jest tablicą:
Array.isArray(Array.prototype);

// poniższe przykłady zwrócą 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 });
</pre>

<h2 id="Polyfill" name="Polyfill">Dostępność wsteczna</h2>

<p>Jeśli metody <span style="font-family: consolas,monaco,andale mono,monospace; line-height: 23.3333339691162px;">Array.isArray() nie jest natywnie dostępna, poniższy kod ją utworzy.</span></p>

<pre class="brush: js">if (!Array.isArray) {
  Array.isArray = function(arg) {
    return Object.prototype.toString.call(arg) === '[object Array]';
  };
}
</pre>

<h2 id="Specifications" name="Specifications">Specyfikacja</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specyfikacja</th>
   <th scope="col">Status</th>
   <th scope="col">Komentarz</th>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.4.3.2', 'Array.isArray')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td>Wstępna definicja. Implementacja od  JavaScript 1.8.5.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-array.isarray', 'Array.isArray')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">Zgodność z przeglądarkami</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome("5")}}</td>
   <td>{{CompatGeckoDesktop("2.0")}}</td>
   <td>{{CompatIE("9")}}</td>
   <td>{{CompatOpera("10.5")}}</td>
   <td>{{CompatSafari("5")}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoMobile("2.0")}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>Based on <a href="http://kangax.github.com/es5-compat-table/">Kangax's compat table</a>.</p>

<h2 id="See_also" name="See_also">Zobacz także</h2>

<ul>
 <li>{{jsxref("Global_Objects/Array", "Array")}}</li>
</ul>