High Order Function and Closure
const hof = () => () => 5;
hof()(); // 5
const hof = fn => fn(5);
const a = num => num;
hof(a) // 5const closure = function() {
let count = 0;
return function increment() {
count++;
return count;
};
};
const incrementFn = closure();
incrementFn(); //1
incrementFn(); //2
incrementFn(); //3Last updated