8
var self = this?
이벤트 핸들러에 대한 콜백의 범위 변경으로 인스턴스 메소드를 사용 this에서 "내 예" 로 "바로 콜백이라고 무엇이든을" . 내 코드는 다음과 같습니다 function MyObject() { this.doSomething = function() { ... } var self = this $('#foobar').bind('click', function(){ self.doSomethng() // this.doSomething() would not work here }) } 작동하지만 이것이 최선의 방법입니까? 나에게 …