Created
November 26, 2013 03:38
-
-
Save amiller/7653125 to your computer and use it in GitHub Desktop.
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
| function g0() { return 0; } | |
| function g1(a1) { | |
| return a1; | |
| } | |
| function g2(a1,a2) { | |
| return a1 + a2; | |
| } | |
| function g3(a1,a2,a3) { | |
| return a1 + a2 + a3; | |
| } | |
| function f(a1,a2,a3,a4,a5,a6,a7) { | |
| if (a1 === undefined) return g0(); | |
| if (a2 === undefined) return g1(a1); | |
| if (a3 === undefined) return g2(a1,a2); | |
| return g3(a1,a2,a3); | |
| } | |
| console.log(['f(1)', f(1)]); | |
| console.log(['f(2,3)', f(2,3)]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment