aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/array/isarray/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/array/isarray/index.md')
-rw-r--r--files/fr/web/javascript/reference/global_objects/array/isarray/index.md101
1 files changed, 41 insertions, 60 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/array/isarray/index.md b/files/fr/web/javascript/reference/global_objects/array/isarray/index.md
index f57266afff..c4b10b3082 100644
--- a/files/fr/web/javascript/reference/global_objects/array/isarray/index.md
+++ b/files/fr/web/javascript/reference/global_objects/array/isarray/index.md
@@ -11,40 +11,40 @@ tags:
translation_of: Web/JavaScript/Reference/Global_Objects/Array/isArray
original_slug: Web/JavaScript/Reference/Objets_globaux/Array/isArray
---
-<div>{{JSRef}}</div>
+{{JSRef}}
-<p>La méthode <code><strong>Array.isArray()</strong></code> permet de déterminer si l'objet passé en argument est un objet {{jsxref("Array")}}, elle renvoie <code>true</code> si le paramètre passé à la fonction est de type <code>Array</code> et <code>false</code> dans le cas contraire.</p>
+La méthode **`Array.isArray()`** permet de déterminer si l'objet passé en argument est un objet {{jsxref("Array")}}, elle renvoie `true` si le paramètre passé à la fonction est de type `Array` et `false` dans le cas contraire.
-<pre class="brush: js">Array.isArray([1, 2, 3]); // true
+```js
+Array.isArray([1, 2, 3]); // true
Array.isArray({toto: 123}); // false
Array.isArray("tototruc"); // false
Array.isArray(undefined); // false
-</pre>
+```
-<h2 id="Syntaxe">Syntaxe</h2>
+## Syntaxe
-<pre class="syntaxbox">Array.isArray(<var>value</var>)</pre>
+ Array.isArray(value)
-<h3 id="Paramètres">Paramètres</h3>
+### Paramètres
-<dl>
- <dt><code>value</code></dt>
- <dd>La valeur dont on veut vérifier le type</dd>
-</dl>
+- `value`
+ - : La valeur dont on veut vérifier le type
-<h3 id="Valeur_de_retour">Valeur de retour</h3>
+### Valeur de retour
-<p><code>true</code> si la valeur est un tableau (une instance de {{jsxref("Array")}}), <code>false</code> sinon.</p>
+`true` si la valeur est un tableau (une instance de {{jsxref("Array")}}), `false` sinon.
-<h2 id="Description">Description</h2>
+## Description
-<p>Si l'objet indiqué en paramètre est un {{jsxref("Array")}}, la méthode renvoie <code>true</code>, sinon, elle renvoie <code>false</code>.</p>
+Si l'objet indiqué en paramètre est un {{jsxref("Array")}}, la méthode renvoie `true`, sinon, elle renvoie `false`.
-<p>Voir aussi : « <a href="http://web.mit.edu/jwalden/www/isArray.html">Determining with absolute accuracy whether or not a JavaScript object is an array</a> » (en anglais) pour avoir plus de détails. Si on passe un objet {{jsxref("TypedArray")}} en argument, ce sera toujours la valeur <code>false</code> qui sera renvoyée.</p>
+Voir aussi : « [Determining with absolute accuracy whether or not a JavaScript object is an array](http://web.mit.edu/jwalden/www/isArray.html) » (en anglais) pour avoir plus de détails. Si on passe un objet {{jsxref("TypedArray")}} en argument, ce sera toujours la valeur `false` qui sera renvoyée.
-<h2 id="Exemples">Exemples</h2>
+## Exemples
-<pre class="brush: js">// Tous les appels suivant renvoient true
+```js
+// Tous les appels suivant renvoient true
Array.isArray([]);
Array.isArray([1]);
Array.isArray(new Array());
@@ -64,51 +64,32 @@ Array.isArray(true);
Array.isArray(false);
Array.isArray(new Uint8Array(32));
Array.isArray({ __proto__ : Array.prototype });
-</pre>
+```
-<h2 id="Prothèse_d'émulation_(polyfill)">Prothèse d'émulation (<em>polyfill</em>)</h2>
+## Prothèse d'émulation (_polyfill_)
-<p>Exécuter ce code avant tout les autres aboutira à la création de la méthode <code>Array.isArray()</code>si elle n'est pas nativement prise en charge par le navigateur.</p>
+Exécuter ce code avant tout les autres aboutira à la création de la méthode `Array.isArray()`si elle n'est pas nativement prise en charge par le navigateur.
-<pre class="brush: js">if(!Array.isArray) {
+```js
+if(!Array.isArray) {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
-}</pre>
-
-<h2 id="Spécifications">Spécifications</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Spécification</th>
- <th scope="col">État</th>
- <th scope="col">Commentaires</th>
- </tr>
- <tr>
- <td>{{SpecName('ES5.1', '#sec-15.4.3.2', 'Array.isArray')}}</td>
- <td>{{Spec2('ES5.1')}}</td>
- <td>Définition initiale. Implémentée avec JavaScript 1.8.5.</td>
- </tr>
- <tr>
- <td>{{SpecName('ES6', '#sec-array.isarray', 'Array.isArray')}}</td>
- <td>{{Spec2('ES6')}}</td>
- <td> </td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-array.isarray', 'Array.isArray')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
-
-<p>{{Compat("javascript.builtins.Array.isArray")}}</p>
-
-<h2 id="Voir_aussi">Voir aussi</h2>
-
-<ul>
- <li>{{jsxref("Array")}}</li>
-</ul>
+}
+```
+
+## Spécifications
+
+| Spécification | État | Commentaires |
+| ------------------------------------------------------------------------------------ | ---------------------------- | ------------------------------------------------------- |
+| {{SpecName('ES5.1', '#sec-15.4.3.2', 'Array.isArray')}} | {{Spec2('ES5.1')}} | Définition initiale. Implémentée avec JavaScript 1.8.5. |
+| {{SpecName('ES6', '#sec-array.isarray', 'Array.isArray')}} | {{Spec2('ES6')}} |   |
+| {{SpecName('ESDraft', '#sec-array.isarray', 'Array.isArray')}} | {{Spec2('ESDraft')}} |   |
+
+## Compatibilité des navigateurs
+
+{{Compat("javascript.builtins.Array.isArray")}}
+
+## Voir aussi
+
+- {{jsxref("Array")}}