Created
January 6, 2012 08:16
-
-
Save psiborg/1569643 to your computer and use it in GitHub Desktop.
JS Context Bind 1
This file contains 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 myObject = { | |
someProperty: 42 | |
}; | |
function adder (num1, num2) { | |
return this.someProperty + num1 + num2; | |
} | |
console.log(adder.call(myObject, 10, 20)); // 72 | |
console.log(adder.apply(myObject, [10, 20])); // 72 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment