--- title: Set.prototype.has() slug: Web/JavaScript/Reference/Global_Objects/Set/has tags: - ECMAScript6 - JavaScript - Prototype - set translation_of: Web/JavaScript/Reference/Global_Objects/Set/has original_slug: Web/JavaScript/Referencia/Objetos_globales/Set/has ---
El método has()
retorna un booleano indicando si el elemento especificado existe en el objeto Set
o no.
mySet.has(value);
Set
.true
si el elemento con el valor especificado existe en el objeto Set
; de otra manera retorna false
.has
var mySet = new Set(); mySet.add("foo"); mySet.has("foo"); // retorna true mySet.has("bar"); // retorna false
Especificación | Estado | Comentario |
---|---|---|
{{SpecName('ES6', '#sec-set.prototype.has', 'Set.prototype.has')}} | {{Spec2('ES6')}} | Definición inicial. |
{{SpecName('ESDraft', '#sec-set.prototype.has', 'Set.prototype.has')}} | {{Spec2('ESDraft')}} |