Created
January 4, 2014 11:57
-
-
Save sebmck/8254705 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
function plus(a, b){ | |
switch (a) { | |
case "0": | |
switch (b) { | |
case "0": return 0; | |
case "1": return 1; | |
case "2": return 2; | |
case "3": return 3; | |
case "4": return 4; | |
case "5": return 5; | |
case "6": return 6; | |
case "7": return 7; | |
case "8": return 8; | |
case "9": return 9; | |
} | |
break; | |
case "1": | |
switch (b) { | |
case "0": return 1; | |
case "1": return 2; | |
case "2": return 3; | |
case "3": return 4; | |
case "4": return 5; | |
case "5": return 6; | |
case "6": return 7; | |
case "7": return 8; | |
case "8": return 9; | |
case "9": return 10; | |
} | |
break; | |
case "2": | |
switch (b) { | |
case "0": return 2; | |
case "1": return 3; | |
case "2": return 4; | |
case "3": return 5; | |
case "4": return 6; | |
case "5": return 7; | |
case "6": return 8; | |
case "7": return 9; | |
case "8": return 10; | |
case "9": return 11; | |
} | |
break; | |
} | |
throw new Error("unsupported arguments"): | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment