aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/map/clear/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/map/clear/index.md')
-rw-r--r--files/fr/web/javascript/reference/global_objects/map/clear/index.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/map/clear/index.md b/files/fr/web/javascript/reference/global_objects/map/clear/index.md
new file mode 100644
index 0000000000..5c0dbc8661
--- /dev/null
+++ b/files/fr/web/javascript/reference/global_objects/map/clear/index.md
@@ -0,0 +1,75 @@
+---
+title: Map.prototype.clear()
+slug: Web/JavaScript/Reference/Global_Objects/Map/clear
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - Map
+ - Méthode
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Map/clear
+original_slug: Web/JavaScript/Reference/Global_Objects/Map/clear
+---
+<div>{{JSRef}}</div>
+
+<p>La méthode <code><strong>clear()</strong></code> supprime tous les éléments d'un objet <code>Map</code>.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/map-prototype-clear.html")}}</div>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="syntaxbox"><var>maMap</var>.clear();</pre>
+
+<h3 id="Valeur_de_retour">Valeur de retour</h3>
+
+<p>{{jsxref("undefined")}}.</p>
+
+<h2 id="Exemple">Exemple</h2>
+
+<h3 id="Utiliser_la_méthode_clear()">Utiliser la méthode <code>clear()</code></h3>
+
+<pre class="brush: js">var maMap = new Map();
+maMap.set("truc", "bidule");
+maMap.set(1, "toto");
+
+maMap.size; // 2
+maMap.has("truc"); // true
+
+maMap.clear();
+
+maMap.size; // 0
+maMap.has("truc") // false
+</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-map.prototype.clear', 'Map.prototype.clear')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Définition initiale.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-map.prototype.clear', 'Map.prototype.clear')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
+
+<p>{{Compat("javascript.builtins.Map.clear")}}</p>
+
+<h2 id="Voir_aussi">Voir aussi</h2>
+
+<ul>
+ <li>{{jsxref("Map")}}</li>
+</ul>