javascriptvisualizer
javascriptvisualizer copied to clipboard
Throws Error - white screen
Throws error when running this code. And screen becomes blank
function createAdder(baseNumber) {
return function(otherNumber) {
if (otherNumber <= baseNumber) {
return otherNumber + baseNumber;
} else {
return createAdder(otherNumber + baseNumber);
}
}
}
let result = createAdder(1)(3)(5)(0);
console.log(result);
Expected output is 9