Skip to content

Commit

Permalink
[es] translate map clear
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker8 committed Aug 21, 2024
1 parent 269caf1 commit 4165571
Showing 1 changed file with 56 additions and 0 deletions.
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")}}

0 comments on commit 4165571

Please sign in to comment.