--- title: Set.prototype.has() slug: Web/JavaScript/Referencia/Objectes_globals/Set/has translation_of: Web/JavaScript/Reference/Global_Objects/Set/has ---
El mètode has() retorna un booleà que indica si l'element amb el valor especificat existeix o no dins l'objecte Set.
mySet.has(valor);
Set.true si existex un element amb el valor especificat dins l'objecte Set; en cas contrari retorna false.hasvar mySet = new Set();
mySet.add("foo");
mySet.has("foo"); // retorna true
mySet.has("bar"); // retorna false
| Especificació | Estat | Comentaris |
|---|---|---|
| {{SpecName('ES6', '#sec-set.prototype.has', 'Set.prototype.has')}} | {{Spec2('ES6')}} | Definició inicial. |
{{CompatibilityTable}}
| Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Suport bàsic | 38 | {{CompatGeckoDesktop("13.0")}} | 11 | 25 | 7.1 |
| Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Suport bàsic | {{CompatNo}} | 38 | {{CompatGeckoMobile("13.0")}} | {{CompatNo}} | {{CompatNo}} | 8 |