Baseline Widely available
Set
ê°ì²´ì @@iterator
ë©ìëë Iteration íë¡í ì½ì 구ííë©°, ì ê° êµ¬ë¬¸ ë° for...of
루íì ê°ì´ ìí를 ììíë ëë¶ë¶ì 구문ìì Setì ì¬ì©í ì ìëë¡ í©ëë¤. Setì ê°ì ì°ì¶íë ë°ë³µì를 ë°íí©ëë¤.
ì´ ìì±ì ì´ê¸° ê°ì Set.prototype.values
ìì±ì ì´ê¸° ê°ê³¼ ëì¼í í¨ì ê°ì²´ì
ëë¤.
const set1 = new Set();
set1.add(42);
set1.add("forty two");
const iterator1 = set1[Symbol.iterator]();
console.log(iterator1.next().value);
// Expected output: 42
console.log(iterator1.next().value);
// Expected output: "forty two"
구문 ë°í ê°
Set.prototype.values()
ì ëì¼íê² setì ê°ì ì°ì¶íë ìë¡ì´ ë°ë³µ ê°ë¥í ë°ë³µì ê°ì²´ë¥¼ ë°íí©ëë¤.
ì´ ë©ìë를 ì§ì í¸ì¶í íìë ê±°ì ììµëë¤. @@iterator
ë©ìëì ì¡´ì¬ë Set
ê°ì²´ê° ë°ë³µ ê°ë¥íê² í´ì£¼ë©°, for...of
루íì ê°ì ë°ë³µ 구문ì ì´ ë©ìë를 ìëì¼ë¡ í¸ì¶íì¬ ë£¨í를 ë릴 ë°ë³µì를 ì»ê² ë©ëë¤.
const mySet = new Set();
mySet.add("0");
mySet.add(1);
mySet.add({});
for (const v of mySet) {
console.log(v);
}
ë°ë³µì ìëì¼ë¡ ë리기
ë°íë ë°ë³µì ê°ì²´ì next()
ë©ìë를 ìëì¼ë¡ í¸ì¶íì¬ ë°ë³µ íë¡ì¸ì¤ë¥¼ ìµëí ì ì´í ì ììµëë¤.
const mySet = new Set();
mySet.add("0");
mySet.add(1);
mySet.add({});
const setIter = mySet[Symbol.iterator]();
console.log(setIter.next().value); // "0"
console.log(setIter.next().value); // 1
console.log(setIter.next().value); // Object
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4