화살표 함수 this

수빈·2023년 2월 17일
0

etc

목록 보기
9/12
Set.prototype.intersection = function (set) {
    console.log(this);
    const aa = this;
    return new Set([...[1,2]].filter(v => {
        // set.has(v);
        console.log(aa === this); // true
    }));
};

// 화살표 함수의 this 는 상위 스코프의 this를 가리킨다.

// 화살표 함수 없으면 전역 객체

0개의 댓글