--- title: WeakSet.prototype.has() slug: Web/JavaScript/Reference/Global_Objects/WeakSet/has translation_of: Web/JavaScript/Reference/Global_Objects/WeakSet/has ---
El mètode has() retorna un booleà indicant si un objecte existeix o no en unmethod returns a boolean indicating whether an object exists in a WeakSet or not.
ws.has(valor);
WeakSet.true si un element amb el valor especificat existeix en l'objecte WeakSet; en el cas contrari retornarà false.hasvar ws = new WeakSet();
var obj = {};
ws.add(window);
mySet.has(window); // retorna true
mySet.has(obj); // retorna false
| Especificació | Estat | Comentaris |
|---|---|---|
| {{SpecName('ES6', '#sec-weakset.prototype.has', 'WeakSet.prototype.has')}} | {{Spec2('ES6')}} | Definició inicial. |
{{CompatibilityTable}}
| Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Suport bàsic | 36 | {{CompatGeckoDesktop(34)}} | {{CompatNo}} | 23 | {{CompatNo}} |
| Característica | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Suport bàsic | {{CompatNo}} | {{ CompatGeckoMobile(34) }} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |