Skip to Content
자바스크립트 완벽 가이드
book

자바스크립트 완벽 가이드

by David Flanagan, Han Seon- yong
February 2022
Beginner to intermediate
784 pages
24h 53m
Korean
Insight
Content preview from 자바스크립트 완벽 가이드
JavaScript
376
12장 이터레이터와 제너레이터
let m
=
new Map([["one", 1], ["two", 2]]);
for(let [k,v] of m) console.log(k, v); // 'one 1', 'two 2'
keys()
와
values()
메서드를 써서 키만 순회하거나 값만 순회할 수 있습니다.
[...m] //
=
> [["one", 1], ["two", 2]]:
기본
순회
[...m.entries()] //
=
> [["one", 1], ["two", 2]]: entries()
메서드도
같습니다
.
[...m.keys()] //
=
> ["one", "two"]: keys()
메서드는
키만
순회합니다
.
[...m.values()] //
=
> [1, 2]: values()
메서드는
값만
순회합니다
.
마지막으로, 배열에 흔히 사용되는 내장 함수와 생성자 상당수는 ES6로 넘어오면
서 임의의 이터레이터를 받도록 작성됐습니다.
Set()
생성자도 그런 API 중 하나입
니다.
//
문자열은
이터러블이므로
두
세트는
같습니다
.
new Set("abc") //
=
> new Set(["a", "b", "c"])
이 장에서는 이터레이터가 어떻게 동작하는지 설명하고 이터러블 데이터 구조를
직접 만드는 방법을 설명합니다. 기본적인 이터레이터를 설명한 다음에는 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

개발자를 위한 필수 수학

개발자를 위한 필수 수학

토머스 닐드
개발 7년차, 매니저 1일차

개발 7년차, 매니저 1일차

권원상, 한민주, 카미유 푸르니에

Publisher Resources

ISBN: 9788966263462