JS this Bind

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2020 Apr 27 5:30
Editor
Edited
Edited
2021 Apr 22 3:12
Refs
Refs

new > explicit > implicit > global

화살표 함수는, this에 바인딩할 객체가 정적으로 결정 (implicit this binding 안함)
생성자 함수같은 경우에는, 함수 호출 방식에 따라 this에 바인딩할 객체가 동적으로 결정
JS this Bind Methods
1) new로 함수를 호출했는가? 그럼 실행결과 반환되는 값이 this다.
2) call, apply, bind로 함수를 호출했는가? 그럼 인자로 넘겨준 객체가 this다.
3) 객체 프로퍼티로 접근하여 함수를 실행했는가? 그럼 이 객체가 this다.
4) 이외의 경우는 this는 전역 객체다.
 
 
 
 

Recommendations