UNPKG

ds-algo-study

Version:

Just experimenting with publishing a package

29 lines (19 loc) 806 B
/*********************************************************************** Write a function named `dynamicDivide(divisor)`. The dynamicDivide function will return a new function that when invoked will divide the argument number by the divisor. Look below to see how this function is invoked: const halfer = dynamicDivide(2); // returns a function halfer(20); // returns 10 const divideByThree = dynamicDivide(3); divideByThree(30); // returns 10 const divideByFive = dynamicDivide(5); divideByFive(50); // returns 10 ***********************************************************************/ function dynamicDivide(divisor) { return function (dividend) { return dividend / divisor; }; } /**************DO NOT MODIFY ANYTHING UNDER THIS LINE*****************/ module.exports = dynamicDivide;