Last active
December 16, 2015 03:29
-
-
Save hrkd/5369785 to your computer and use it in GitHub Desktop.
applyの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 fncObj = { | |
val : 0, | |
method : function(){ | |
console.log(this.val); | |
} | |
} | |
var obj = { | |
val:1 | |
} | |
var obj2 = { | |
val:2 | |
} | |
fncObj.method.apply(obj); | |
fncObj.method.apply(obj2); | |
fncObj.method(); | |
// 1 | |
// 2 | |
// 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment