--- title: Set.prototype.values() slug: Web/JavaScript/Reference/Global_Objects/Set/values translation_of: Web/JavaScript/Reference/Global_Objects/Set/values ---
Il metodo values()
restituisce un nuovo oggetto di tipo Iterator
che contiene tutti i valori presenti nell'oggetto Set
, nell'ordine con cui sono stati inseriti.
Il metodo keys()
è un alias per questo metodo (in modo da mantenere api simili all'oggetto {{jsxref("Map")}}); si comporta esattamente allo stesss modo e restiuisce i valori contenuti nell'oggetto Set
.
mySet.values();
Un nuovo oggetto di tipo Iterator
che contiene tutti i valori presenti nell'oggetto Set
, nell'ordine con cui sono stati inseriti.
values()
var mySet = new Set(); mySet.add("foo"); mySet.add("bar"); mySet.add("baz"); var setIter = mySet.values(); console.log(setIter.next().value); // "foo" console.log(setIter.next().value); // "bar" console.log(setIter.next().value); // "baz"
Specifiche | Stato | Commenti |
---|---|---|
{{SpecName('ES6', '#sec-set.prototype.values', 'Set.prototype.values')}} | {{Spec2('ES6')}} | Initial definition. |
{{SpecName('ESDraft', '#sec-set.prototype.values', 'Set.prototype.values')}} | {{Spec2('ESDraft')}} |
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 38 | {{CompatGeckoDesktop("24")}} | {{CompatNo}} | 25 | 7.1 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | 38 | {{ CompatGeckoMobile("24") }} | {{ CompatNo}} | {{ CompatNo}} | 8 |