--- title: Set.prototype.clear() slug: Web/JavaScript/Referencje/Obiekty/Set/Set.prototype.clear() tags: - ECMAScript 2015 - JavaScript - Method - Prototype - set translation_of: Web/JavaScript/Reference/Global_Objects/Set/clear ---
Metoda clear() usuwa wszystkie elementy obiektu Set
.
mySet.clear();
{{jsxref("undefined")}}.
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
Specyfikacja | Status | Komentarz |
---|---|---|
{{SpecName('ES2015', '#sec-set.prototype.clear', 'Set.prototype.clear')}} | {{Spec2('ES2015')}} | Początkowa definicja. |
{{SpecName('ESDraft', '#sec-set.prototype.clear', 'Set.prototype.clear')}} | {{Spec2('ESDraft')}} |
{{CompatibilityTable}}
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 38 | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("19.0")}} | 11 | 25 | 7.1 |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | 25 | {{CompatVersionUnknown}} | {{CompatGeckoMobile("19.0")}} | {{CompatNo}} | {{CompatNo}} | 8 |