Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[34~37장] 이터러블, 스프레드 문법, 디스트럭처링 할당, Set과 Map #57

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 34장 이터러블/김재후.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- iterable은 순회를 하는 방법에 대한 통일된 프로토콜이다. 이 프로토콜로 통일된 방법으로 데이터를 순회할 수 있게 된다.
- iterable 프로토콜을 준수한다면 `for... of`, `...`(스프레드), `배열 디스트럭쳐링`을 사용할 수 있다.
- 객체의 `Symbol.iterator`프로퍼티가 있어야 이터러블을 사용할 수 있다. 해당 프로퍼티에는 iterator 객체가 존재한다.
- iterator는 순회 리스트의 아이템에 대한 포인터 역할을 한다.
- iterator 객체는 next 메소드를 갖고 이 메소드는 `{value : any , done : boolean}`을 리턴한다
3 changes: 3 additions & 0 deletions 35장 스프레드 문법/김재후.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- 스프레드 문법은 값이 아님. 따라서 할당할 수 없다.
- ...Rest parameter와 반대방향. Rest parameter는 펼쳐진것을 묶어서 배열로 만들어주는 반면 스프레드 문법은 iterable 객체를 펼치는것! [1,2,3] -> 1, 2, 3
- 객체 스프레드는 원래는 없었지만 새롭게 추가됐다고 한다.