Skip to content

[토의] Symbol.Iterable 의 용도에 대하여 #14

Description

@jessi68

질문

iterable 객체의 용도에 대하여

상세내용

iterable 객체는 destruct, for ... of 문, 스프레드 문 등의 문법 등을 사용할 수 있는 객체 입니다. 이러한 특성은 일반 객체에서는 볼 수 없습니다. 그래서 일반 객체를 iterable 한 객체처럼 사용하고 싶을 때에는
변수이름Symbol.iterator 가 반환한 객체를 iterable 객체로 사용할 수가 있습니다.
제 개인적인 생각으로는 iterable 객체의 기능들을 상속 형태로 받으면, 각 객체가 iterable 에 너무 종속되는 경향이 있어
Symbol.Iterator 함수를 사용해 iterable 객체의 특성이 담긴 코드들을 붙였다 뗐다 하는 식으로 사용을 하면
더 자유롭지 않나 싶어서 이 함수가 필요한 것 같습니다.

참고

34 단원

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions