-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
files/es/web/javascript/reference/global_objects/map/clear/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Map.prototype.clear() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/clear | ||
l10n: | ||
sourceCommit: 27180875516cc311342e74b596bfb589b7211e0c | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`clear()`** de las instancias {{jsxref("Map")}} remueve todos los elementos de este _map_. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-clear.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
clear() | ||
``` | ||
|
||
### Parámetros | ||
|
||
Ningúno. | ||
|
||
### Valor devuelto | ||
|
||
Ningúno ({{jsxref("undefined")}}). | ||
|
||
## Ejemplos | ||
|
||
### Usando clear() | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("bar", "baz"); | ||
myMap.set(1, "foo"); | ||
|
||
console.log(myMap.size); // 2 | ||
console.log(myMap.has("bar")); // true | ||
|
||
myMap.clear(); | ||
|
||
console.log(myMap.size); // 0 | ||
console.log(myMap.has("bar")); // false | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} |