El mètode delete()
esborra l'element especificat emmagatzemat dins l'objecte Set
.
Sintaxi
mySet.delete(valor);
Paràmetres
- valor
- Obligatori. El valor de l'element a eliminar.
Valor retornat
Retorna true
si s'ha pogut eliminar l'element de l'objecte Set
; en cas contrari retorna false
.
Exemples
Utilitzar el mètode delete
var mySet = new Set();
mySet.add("foo");
mySet.delete("bar"); // Retorna false. No s'ha trobat l'element "bar".
mySet.delete("foo"); // Retorna true. S'ha pogut esborrar l'element "foo".
mySet.has("foo"); // Retorna false. L'element "foo" ja no existeix dins el Set.
Especificacions
Especificació | Estat | Comentaris |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Set.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 | 38 | 13.0 (13.0) | 11 | 25 | 7.1 |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Suport bàsic | No support | 38 | 13.0 (13.0) | No support | No support | 8 |