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.
Sintaxi
ws.has(valor);
Paràmetres
- valor
- Necessari. L'objecte a comprovar la seva presència en
WeakSet
.
Valor de retorn
- Booleà
- Retorna
true
si un element amb el valor especificat existeix en l'objecteWeakSet
; en el cas contrari retornaràfalse
.
Exemples
Utilitzar el mètode has
var ws = new WeakSet();
var obj = {};
ws.add(window);
mySet.has(window); // retorna true
mySet.has(obj); // retorna false
Especificacions
Especificació | Estat | Comentaris |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'WeakSet.prototype.has' in that specification. |
Standard | Definició inicial. |
Compatibilitat amb navegadors
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | 36 | 34 (34) | No support | 23 | No support |
Característica | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Suport bàsic | No support | 34.0 (34) | No support | No support | No support |