-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
files/es/web/javascript/reference/global_objects/map/has/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,53 @@ | ||
--- | ||
title: Map.prototype.has() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/has | ||
l10n: | ||
sourceCommit: 3cfd663738e9963157d90f359789d675a6662ec2 | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`has()`** de las instancias {{jsxref("Map")}} regresa un booleano indicando si un elemento con la llave especificada existe o no en este _map_. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-has.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
has(key) | ||
``` | ||
|
||
### Parámetros | ||
|
||
- `key` | ||
- : La llave del elemento que se quiere probar si existe en el objeto `Map`. | ||
|
||
### Valor devuelto | ||
|
||
`true` si un elemento con la llave especificada existe en el objeto `Map`; de lo contrario `false`. | ||
|
||
## Ejemplos | ||
|
||
### Usando has() | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("bar", "foo"); | ||
|
||
console.log(myMap.has("bar")); // true | ||
console.log(myMap.has("baz")); // false | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} | ||
- {{jsxref("Map.prototype.set()")}} | ||
- {{jsxref("Map.prototype.get()")}} |