Created
May 22, 2013 21:01
-
-
Save ginpei/5630870 to your computer and use it in GitHub Desktop.
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 obj1 = { name:'Alice' }; | |
var obj2 = { name:'Bob' }; | |
function say(talk, age) { | |
console.log(talk + ', I am ' + this.name + ', ' + age + ' years old.'); | |
} | |
say.apply(obj1, ['Hi', 12]); // "Hi, I am Alice, 12 years old." | |
say.apply(obj2, ['Good morning', 36]); // "Good morning, I am Bob, 36 years old." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment