Created
February 14, 2012 13:48
-
-
Save sifue/1826900 to your computer and use it in GitHub Desktop.
JavaScriptでapplyを使ってメソッド呼び出しする ref: http://qiita.com/items/2489
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 add = function (a, b) { | |
return a + b; | |
}; | |
var array = [3, 4]; | |
// first argument is "this"、second is parameters. | |
var sum = add.apply(null, array); //sum is 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment