diff options
| author | julieng <julien.gattelier@gmail.com> | 2021-08-03 08:03:09 +0200 |
|---|---|---|
| committer | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-09-03 08:08:25 +0200 |
| commit | 844f5103992238c0c23203286dad16a466e89c97 (patch) | |
| tree | d537708951bb2b61be8192ffacc05a0ce6804f89 /files/fr/web/javascript/reference/global_objects/array/of/index.html | |
| parent | a70fd5b73ecb10bec3906640023e2a1a46e118a2 (diff) | |
| download | translated-content-844f5103992238c0c23203286dad16a466e89c97.tar.gz translated-content-844f5103992238c0c23203286dad16a466e89c97.tar.bz2 translated-content-844f5103992238c0c23203286dad16a466e89c97.zip | |
move *.html to *.md
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/array/of/index.html')
| -rw-r--r-- | files/fr/web/javascript/reference/global_objects/array/of/index.html | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/array/of/index.html b/files/fr/web/javascript/reference/global_objects/array/of/index.html deleted file mode 100644 index 68508d936f..0000000000 --- a/files/fr/web/javascript/reference/global_objects/array/of/index.html +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Array.of() -slug: Web/JavaScript/Reference/Global_Objects/Array/of -tags: - - Array - - ECMAScript 2015 - - JavaScript - - Méthode - - polyfill -translation_of: Web/JavaScript/Reference/Global_Objects/Array/of -original_slug: Web/JavaScript/Reference/Objets_globaux/Array/of ---- -<div>{{JSRef}}</div> - -<p>La methode <code><strong>Array.of()</strong></code> permet de créer une nouvelle instance d'objet <code>Array</code> à partir d'un nombre variable d'arguments, quels que soient leur nombre ou leur type.</p> - -<p>La différence entre <code><strong>Array.of()</strong></code> et le constructeur <code><strong>Array</strong></code> se situe dans la gestion de d'arguments entiers : <strong><code>Array.of(7)</code></strong> crée un tableau avec un seul élément, 7, tandis que <strong><code>Array(7)</code></strong> produit un tableau avec 7 éléments vides (à ne pas confondre avec des éléments qui auraient explicitement la valeur <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/undefined">undefined</a></code>).</p> - -<pre class="brush: js">Array.of(7); // [7] -Array.of(1, 2, 3); // [1, 2, 3] - -Array(7); // un tableau avec 7 emplacements vides -Array(1, 2, 3); // [1, 2, 3] -</pre> - -<h2 id="Syntaxe">Syntaxe</h2> - -<pre class="syntaxbox">Array.of(<em>element0[, element1[, ...[, elementN]]]</em>) -</pre> - -<h3 id="Paramètres">Paramètres</h3> - -<dl> - <dt><em><code>element0</code>, <code>element1</code>, ..., <code>elementN</code></em></dt> - <dd>Les éléments avec lesquels on souhaite construire le nouveau tableau.</dd> -</dl> - -<h3 id="Valeur_de_retour">Valeur de retour</h3> - -<p>Une nouvelle instance de {{jsxref("Array")}}.</p> - -<h2 id="Description">Description</h2> - -<p>Cette fonction fait partie du standard ECMAScript 2015. Pour plus d'informations, voir les pages sur <a href="https://gist.github.com/rwaldron/1074126">la proposition pour <code>Array.of</code> et <code>Array.from</code></a> ainsi que la page sur le <a href="https://gist.github.com/rwaldron/3186576">fragment d'émulation pour <code>Array.of</code></a>.</p> - -<pre class="brush: js">Array.of(7); // [7] -Array.of(1, 2, 3); // [1, 2, 3] - -Array(7); // [ , , , , , , ] -Array(1, 2, 3); // [1, 2, 3] -</pre> - -<h2 id="Exemples">Exemples</h2> - -<pre class="brush: js">Array.of(1); // [1] -Array.of(1, 2, 3); // [1, 2, 3] -Array.of(undefined); // [undefined] -</pre> - -<h2 id="Prothèse_d'émulation_(polyfill)">Prothèse d'émulation (<em>polyfill</em>)</h2> - -<p>Exécuter ce code avant tout autre code permettra de créer la méthode <strong><code>Array.of()</code></strong> si elle n'est pas prise en charge nativement.</p> - -<pre class="brush: js">if (!Array.of) { - Array.of = function() { - return Array.prototype.slice.call(arguments); - }; -}</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('ES2015', '#sec-array.of', 'Array.of')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Définition initiale.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-array.of', 'Array.of')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td></td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("javascript.builtins.Array.of")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li>{{jsxref("Array", "Array")}}</li> - <li>{{jsxref("Array/from", "Array.from")}}</li> - <li>{{jsxref("TypedArray.of()")}}</li> -</ul> |
