Set.prototype.values()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015å¹´7æ.
values() 㯠Set ã¤ã³ã¿ã¼ãã§ã¤ã¹ã®ã¡ã½ããã§ãéåã®æ°ããã¤ãã¬ã¼ã¿ã¼ãªãã¸ã§ã¯ããè¿ãã¾ããããã¯ãã®éåã®ããããã®è¦ç´ ãã®å¤ãæ¿å
¥é ã«è¿ãã¾ãã
試ãã¦ã¿ã¾ããã
const set = new Set();
set.add(42);
set.add("forty two");
const iterator = set.values();
console.log(iterator.next().value);
// äºæ³ãããçµæ: 42
console.log(iterator.next().value);
// äºæ³ãããçµæ: "forty two"
æ§æ
js
values()
弿°
ãªãã
è¿å¤
æ°ããå復å¯è½ãªã¤ãã¬ã¼ã¿ã¼ãªãã¸ã§ã¯ãã§ãã
ä¾
>values() ã®ä½¿ç¨
js
const mySet = new Set();
mySet.add("foo");
mySet.add("bar");
mySet.add("baz");
const setIter = mySet.values();
console.log(setIter.next().value); // "foo"
console.log(setIter.next().value); // "bar"
console.log(setIter.next().value); // "baz"
仿§æ¸
| Specification |
|---|
| ECMAScript® 2027 Language Specification > # sec-set.prototype.values > |