Set.prototype.clear()
El método clear()
remueve todos los elementos de un objeto Set
.
Syntaxis
mySet.clear();
Valor de retorno
Ejemplos
Usando el método clear
var mySet = new Set();
mySet.add(1);
mySet.add("foo");
mySet.size; // 2
mySet.has("foo"); // true
mySet.clear();
mySet.size; // 0
mySet.has("bar") // false
Especificaciones
Especificación | Estado | Comentario |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) La definición de 'Set.prototype.clear' en esta especificación. |
Standard | Initial definition. |
ECMAScript (ECMA-262) La definición de 'Set.prototype.clear' en esta especificación. |
Living Standard |
Compatibilidad de navegadores
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! (en-US)
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Soporte básico | 38 | 19.0 (19.0) | 11 | 25 | 7.1 |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Soporte básico | Sin soporte | 25 | 19.0 (19.0) | Sin soporte | Sin soporte | 8 |