UNPKG

ds-algo-study

Version:

Just experimenting with publishing a package

25 lines (18 loc) 438 B
//Calls closure only after callback is called numTimes... times function afterC ( closure, numTimes ) { return function () { if ( --numTimes <= 0 ) { return closure(); } } } //---------(testing)-------------- function makeAdder(x) { return function(y) { return x + y; }; } let add5 = makeAdder(5); let add10 = makeAdder(10); console.log(add5(2)); // 7 console.log(add10(2)); // 12