화살표함수 (1) 썸네일형 리스트형 JavaScript this 바인딩 이해하기 핵심 개념JavaScript에서 this는 함수가 어떻게 호출되느냐에 따라 결정됩니다. 함수를 작성할 때가 아니라, 실행될 때 결정된다는 게 핵심입니다.1. 기본 바인딩 (Default Binding)함수를 그냥 호출하면 this는 undefined가 됩니다 (strict mode/모듈 환경).function sayName() { console.log(this.name);}sayName(); // TypeError: Cannot read properties of undefined2. 암시적 바인딩 (Implicit Binding)객체의 메서드로 호출하면 this는 .앞의 객체를 가리킵니다.const person = { name: '철수', sayName: function() { console... 이전 1 다음