aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/weakmap/clear/index.md
blob: f08ccf1dad43090d01a140e3572918cecec5da13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
title: WeakMap.prototype.clear()
slug: Web/JavaScript/Reference/Global_Objects/WeakMap/clear
tags:
  - JavaScript
  - Méthode
  - Obsolete
  - Prototype
  - Reference
  - WeakMap
translation_of: Web/JavaScript/Reference/Global_Objects/WeakMap/clear
original_slug: Web/JavaScript/Reference/Objets_globaux/WeakMap/clear
---
{{JSRef}} {{obsolete_header}}

La méthode **`clear()`** permettait de retirer tous les éléments d'un objet `WeakMap` mais celle-ci ne fait plus partie d'ECMAScript.

## Syntaxe

    wm.clear();

## Exemples

```js
var wm = new WeakMap();
var obj = {};

wm.set(obj, "toto");
wm.set(window, "truc");

wm.has(obj); // true
wm.has(window); // true

wm.clear();

wm.has(obj);  // false
wm.has(window);  // false
```

## Spécifications

Cette méthode ne fait partie d'aucune spécification ou brouillon. Cette méthode a fait partie du brouillon ECMAScript 6 jusqu'à la révision 28 (version du 14 octobre 2014) mais a été retiré par la suite. Cette méthode ne fait pas partie du standard final.

## Compatibilité des navigateurs

{{Compat("javascript.builtins.WeakMap.clear")}}

## Voir aussi

- {{jsxref("WeakMap")}}