Created
December 15, 2019 10:17
-
-
Save acagastya/9d5324b5b7064bafa4d5a011a0c897c8 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 num(N) { | |
return function() { | |
const VAL = N; | |
let res = 0; | |
if (arguments.length == 0) return VAL; | |
if (arguments.length == 1) res = eval(N + arguments[0]); | |
return Math.floor(res); | |
}; | |
} | |
one = num(1); | |
two = num(2); | |
three = num(3); | |
four = num(4); | |
five = num(5); | |
six = num(6); | |
seven = num(7); | |
eight = num(8); | |
nine = num(9); | |
one(add(two())); | |
function add(num) { | |
return '+' + num; | |
} | |
function sub(num) { | |
return '-' + num; | |
} | |
function mul(num) { | |
return '*' + num; | |
} | |
function divBy(num) { | |
return '/' + num; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment