aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/array/of
diff options
context:
space:
mode:
authorMasahiro FUJIMOTO <mfujimot@gmail.com>2021-09-04 00:46:12 +0900
committerMasahiro FUJIMOTO <mfujimot@gmail.com>2021-09-04 00:46:12 +0900
commitfe6f6abf2b7c497bf1f97f73a82dde7cf48eb79f (patch)
tree51b7edfc370236684a203f4e69ae67bb7d24b549 /files/fr/web/javascript/reference/global_objects/array/of
parent04ea4edc83cc12142ed151bbea2c65cffc8e76f6 (diff)
parenteeb07fe338cdc90092841d717919f46f9d9e3ff9 (diff)
downloadtranslated-content-fe6f6abf2b7c497bf1f97f73a82dde7cf48eb79f.tar.gz
translated-content-fe6f6abf2b7c497bf1f97f73a82dde7cf48eb79f.tar.bz2
translated-content-fe6f6abf2b7c497bf1f97f73a82dde7cf48eb79f.zip
Merge branch 'main' into 20210818-Glossary/Type
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/array/of')
-rw-r--r--files/fr/web/javascript/reference/global_objects/array/of/index.html102
-rw-r--r--files/fr/web/javascript/reference/global_objects/array/of/index.md87
2 files changed, 87 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>
diff --git a/files/fr/web/javascript/reference/global_objects/array/of/index.md b/files/fr/web/javascript/reference/global_objects/array/of/index.md
new file mode 100644
index 0000000000..cbc2b0c156
--- /dev/null
+++ b/files/fr/web/javascript/reference/global_objects/array/of/index.md
@@ -0,0 +1,87 @@
+---
+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
+---
+{{JSRef}}
+
+La methode **`Array.of()`** permet de créer une nouvelle instance d'objet `Array` à partir d'un nombre variable d'arguments, quels que soient leur nombre ou leur type.
+
+La différence entre **`Array.of()`** et le constructeur **`Array`** se situe dans la gestion de d'arguments entiers : **`Array.of(7)`** crée un tableau avec un seul élément, 7, tandis que **`Array(7)`** produit un tableau avec 7 éléments vides (à ne pas confondre avec des éléments qui auraient explicitement la valeur [`undefined`](/fr/docs/Web/JavaScript/Reference/Objets_globaux/undefined)).
+
+```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]
+```
+
+## Syntaxe
+
+ Array.of(element0[, element1[, ...[, elementN]]])
+
+### Paramètres
+
+- _`element0`, `element1`, ..., `elementN`_
+ - : Les éléments avec lesquels on souhaite construire le nouveau tableau.
+
+### Valeur de retour
+
+Une nouvelle instance de {{jsxref("Array")}}.
+
+## Description
+
+Cette fonction fait partie du standard ECMAScript 2015. Pour plus d'informations, voir les pages sur [la proposition pour `Array.of` et `Array.from`](https://gist.github.com/rwaldron/1074126) ainsi que la page sur le [fragment d'émulation pour `Array.of`](https://gist.github.com/rwaldron/3186576).
+
+```js
+Array.of(7); // [7]
+Array.of(1, 2, 3); // [1, 2, 3]
+
+Array(7); // [ , , , , , , ]
+Array(1, 2, 3); // [1, 2, 3]
+```
+
+## Exemples
+
+```js
+Array.of(1); // [1]
+Array.of(1, 2, 3); // [1, 2, 3]
+Array.of(undefined); // [undefined]
+```
+
+## Prothèse d'émulation (_polyfill_)
+
+Exécuter ce code avant tout autre code permettra de créer la méthode **`Array.of()`** si elle n'est pas prise en charge nativement.
+
+```js
+if (!Array.of) {
+ Array.of = function() {
+ return Array.prototype.slice.call(arguments);
+ };
+}
+```
+
+## Spécifications
+
+| Spécification | État | Commentaires |
+| -------------------------------------------------------------------- | ---------------------------- | -------------------- |
+| {{SpecName('ES2015', '#sec-array.of', 'Array.of')}} | {{Spec2('ES2015')}} | Définition initiale. |
+| {{SpecName('ESDraft', '#sec-array.of', 'Array.of')}} | {{Spec2('ESDraft')}} | |
+
+## Compatibilité des navigateurs
+
+{{Compat("javascript.builtins.Array.of")}}
+
+## Voir aussi
+
+- {{jsxref("Array", "Array")}}
+- {{jsxref("Array/from", "Array.from")}}
+- {{jsxref("TypedArray.of()")}}