Write a function named getAdd5 that returns a new function.
This second function (let's name it add5) should take a number as a parameter, add it with number 5 and return the result.
const add5 = getAdd5();
console.log(add5(3)); // should print "8"
const add5 = getAdd5();
console.log(add5(-11)); // should print "-6"
Unlock all functions
The first 10 functions are free. Get lifetime access to all 100 with a one-time payment — no subscription.
Upgrade to Pro