Write a function named getAddN
that receives a number as a parameter (let's name it N
) and returns a new function.
This second function (let's name it addN
) should take another number as a parameter, add it with N
and return the result.
const addN = getAddN(11);
console.log(addN(23)); // should print "34"
const addN = getAddN(-5);
console.log(addN(5)); // should print "0"