JavaScript Set values()
Example
// Create a Set
const letters = new Set(["a","b","c"]);
// Get all Values
const myIterator = letters.values();
// List all Values
let text = "";
for (const entry of myIterator) {
text += entry;
}
Try it Yourself »
More Examples Below !
Description
The values()
method returns an Iterator object with the values in a set.
The values()
method does not change the original set.
Syntax
set.values()
Parameters
NONE |
Return Value
Type | Description |
Iterator | An iterable object with the values of the set. |
More Examples
Looping the set.values() directly:
// Create a Set
const letters = new Set(["a","b","c"]);
// List all Values
let text = "";
for (const entry of letters.values()) {
text += entry;
}
Try it Yourself »
Browser Support
set.values()
is an ECMAScript6 (ES6) feature.
ES6 (JavaScript 2015) is supported in all modern browsers since June 2017:
Chrome 51 | Edge 15 | Firefox 54 | Safari 10 | Opera 38 |
May 2016 | Apr 2017 | Jun 2017 | Sep 2016 | Jun 2016 |
set.values()
is not supported in Internet Explorer.