-
카테고리
-
세부 분야
프로그래밍 언어
-
해결 여부
미해결
궁금한게 잇는데요 여기서 this는 array값을 출력해주나요?
20.12.11 04:28 작성 조회수 196
0
this 는 a에 array값을 가르키나요 ㅠ?
답변을 작성해보세요.
0
정재남
지식공유자2020.12.11
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]을 바라봄.
답변 1