Skip to content

Instantly share code, notes, and snippets.

@acagastya
Created December 15, 2019 10:17
Show Gist options
  • Save acagastya/9d5324b5b7064bafa4d5a011a0c897c8 to your computer and use it in GitHub Desktop.
Save acagastya/9d5324b5b7064bafa4d5a011a0c897c8 to your computer and use it in GitHub Desktop.
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