인프런 커뮤니티 질문&답변
답변 1
0
정재남
지식공유자
thisArg에 지정된 대상을 가리킵니다.
const a = [1, 2, 3];
a.forEach(function(v, i, array) {
console.log({ v, i, array, this: this });
});
// thisArg를 지정하지 않았으므로 global객체를 바라봄.
a.forEach(function(v, i, array) {
console.log({ v, i, array, this: this });
}, [10]);
// thisArg를 [10]으로 지정하였으므로 [10]을 바라봄.




