Set.prototype.has()
El método has()
retorna un booleano indicando si el elemento especificado existe en el objeto Set
o no.
Sintaxis
mySet.has(value);
Parametros
- valor
-
Requerido. El valor del cual se probará su presencia en el objeto
Set
.
Valor de retorno
- Booleano
-
Retorna
true
si el elemento con el valor especificado existe en el objetoSet
; de otra manera retornafalse
.
Ejemplos
Usando el método has
js
var mySet = new Set();
mySet.add("foo");
mySet.has("foo"); // retorna true
mySet.has("bar"); // retorna false
Especificaciones
Specification |
---|
ECMAScript Language Specification # sec-set.prototype.has |
Compatibilidad con navegadores
BCD tables only load in the browser