Call function with a parameter from another function

I have a function that repeatedly calls another function. The second function has a bool parameter that changes the way it behaves, so when I call the first function I want to have a parameter that specifies the way the second function behaves. void Function1(int n, bool differentBehavior = false) { int a = Function2(n,… Read More Call function with a parameter from another function

Is this the correct recursive way to write curry function?

I can’t understand if this recursive curry function is correct or not. function curry(fn) { return function curryInner(…args) { if (args.length >= fn.length) return fn(…args); return function (…next) { return curryInner(…args, …next); }; }; } const example = { multiplier: 5, calculate: function (a, b) { return (a + b) * this.multiplier; }, }; example.curriedVersion… Read More Is this the correct recursive way to write curry function?