diff options
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/array/isarray')
-rw-r--r-- | files/ca/web/javascript/reference/global_objects/array/isarray/index.html | 136 |
1 files changed, 0 insertions, 136 deletions
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 deleted file mode 100644 index 1b2d93532e..0000000000 --- a/files/ca/web/javascript/reference/global_objects/array/isarray/index.html +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: Array.isArray() -slug: Web/JavaScript/Reference/Global_Objects/Array/isArray -translation_of: Web/JavaScript/Reference/Global_Objects/Array/isArray -original_slug: Web/JavaScript/Referencia/Objectes_globals/Array/isArray ---- -<div>{{JSRef}}</div> - -<p>El mètode <code><strong>Array.isArray()</strong></code>retorna <code>true</code> si un objecte és un array, o <code>false</code> en cas que no ho sigui.</p> - -<h2 id="Sintaxi">Sintaxi</h2> - -<pre class="syntaxbox"><code>Array.isArray(<var>obj</var>)</code></pre> - -<h3 id="Paràmetres">Paràmetres</h3> - -<dl> - <dt><code>obj</code></dt> - <dd>L'objecte que s'ha de comprovar.</dd> -</dl> - -<h2 id="Descripció">Descripció</h2> - -<p>Vegeu l'article <a href="http://web.mit.edu/jwalden/www/isArray.html">“Determinar amb absoluta precisió si un objecte JavaScript és un array o no”</a> per més detalls.</p> - -<h2 id="Exemples">Exemples</h2> - -<pre class="brush: js">// 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 }); -</pre> - -<h2 id="Polyfill">Polyfill</h2> - -<p>Executar el codi següent abans de cap altre codi crearà <code>Array.isArray()</code> si no es troba disponible de forma nativa.</p> - -<pre class="brush: js">if (!Array.isArray) { - Array.isArray = function(arg) { - return Object.prototype.toString.call(arg) === '[object Array]'; - }; -} -</pre> - -<h2 id="Especificacions">Especificacions</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Especificació</th> - <th scope="col">Estat</th> - <th scope="col">Comentaris</th> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.4.3.2', 'Array.isArray')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>Definició inicial. Implementat en 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="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Característica</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Suport bàsic</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>Característica</th> - <th>Android</th> - <th>Chrome per Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Suport bàsic</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> - -<h2 id="Vegeu_també">Vegeu també</h2> - -<ul> - <li>{{jsxref("Array")}}</li> -</ul> |