--- 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')}} |
{{CompatibilityTable}}
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Soporte básico | 38 | {{CompatGeckoDesktop("13.0")}} | 11 | 25 | 7.1 |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Soporte básico | {{CompatNo}} | 38 | {{CompatGeckoMobile("13.0")}} | {{CompatNo}} | {{CompatNo}} | 8 |