El mètode delete()
elimina l'element especificat de l'objecte WeakSet.
Sintaxi
ws.delete(value);
Paràmetres
- value
- Necessari. L'objecte que es vol eliminar de l'objecte
WeakSet.
Return value
Retorna true
si l'element dins l'objecte WeakSet
s'ha eliminat satisfactòriament; Del cas contrari retornarà false
.
Exemples
Utilitzar el mètode delete
var ws = new WeakSet();
var obj = {};
ws.add(window);
ws.delete(obj); // Retorna false. No s'ha trobat cap obj per eliminar.
ws.delete(window); // Retorna true. Eliminat satisfactòriament.
ws.has(window); // Retorna false. window ja no és present en WeakSet.
Especificacions
Especificació | Estat | Comentaris |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'WeakSet.prototype.delete' 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 |