Created
May 19, 2018 17:24
-
-
Save khg0712/7903508ef440b5037bd91f545ed70065 to your computer and use it in GitHub Desktop.
내부 함수의 this 바인딩 예시
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = 10;//전역 변수 a 생성 | |
var object = { | |
a: 1, | |
func1: function() { | |
this.a += 1; | |
console.log('func1: ' + this.a); | |
var func2 = function () { | |
this.a += 1; | |
console.log('func2: ' + this.a); | |
var func3 = function () { | |
this.a += 1; | |
console.log('func3: ' + this.a); | |
} | |
func3(); | |
} | |
func2(); | |
} | |
} | |
object.func1(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment