worldsering,
function number(num) {
const inner = function(n) {
const numberN = function(n1) {
return inner(n * n1);
}
numberN.valueOf = function() { return n; };
numberN.toString = function() { return String(n); };
return numberN;
}
return inner(num);
}
const number5 = number(5);
const number10 = number5(2);
const number30 = number10(3);
const number15 = number5(3); // другая ветка умножения
alert([number5, number10, number30, number15, number10 + number15].join('\n'));