Set.prototype.entries()
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ì.
Set ì¸ì¤í´ì¤ì entries() ë©ìëë Set ê°ì²´ì ê°ê°ì ìì를 ì½ì
ììëë¡ [ê°, ê°]ì ííë¡ ê°ì§ ë°°ì´ì ìë¡ì´ ë°ë³µì ê°ì²´ë¥¼ ë°íí©ëë¤. Setê°ì²´ìë Mapê°ì²´ì keyê° ììµëë¤. ê·¸ë¬ë, Map ê°ì²´ì APIì ë¹ì·íê² ì ì§í기 ìí´, ê°ê°ì "ìì"ë "í¤"ì "ê°" ì리ì ê°ì ê°ì ê°ì§ê² ë©ëë¤. ê²°ê³¼ì ì¼ë¡ [ê°, ê°] ííì ë°°ì´ì´ ë°íëê² ë©ëë¤.
ìëí´ ë³´ê¸°
const set1 = new Set();
set1.add(42);
set1.add("forty two");
const iterator1 = set1.entries();
for (const entry of iterator1) {
console.log(entry);
// Expected output: Array [42, 42]
// Expected output: Array ["forty two", "forty two"]
}
구문
js
entries()
매ê°ë³ì
ìì.
ë°í ê°
ìë¡ì´ ìí ê°ë¥í ë°ë³µì ê°ì²´.
ìì
>entries() ì¬ì©í기
js
const mySet = new Set();
mySet.add("foobar");
mySet.add(1);
mySet.add("baz");
const setIter = mySet.entries();
console.log(setIter.next().value); // ["foobar", "foobar"]
console.log(setIter.next().value); // [1, 1]
console.log(setIter.next().value); // ["baz", "baz"]
ëª ì¸ì
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-set.prototype.entries> |