선언식 함수와 화살표 함수에서의 this
브라우저에서 this는 Window 객체를 가르킨다. 그리고 Node에서 this는 global 객체를 가르킨다. (정확히는 최상위에서 호출 시 module.exports / exports를 가르키고, 함수 내부에서 호출 시 global 객체를 가르킨다) 이렇게 this는 환경에 따라서 다른 객체를 가르킨다. 선언식 함수 이는 function 선언식에서도 다르지 않는데, this는 함수의 호출, 실행 단계에서 동적으로 결정된다. // 브라우저 function test1() { return function consoleA() { console.log(this); } } const test3 = test1(); test3(); // Window 객체 function test2() { console.log(t..