Clousers; high order function examples

function f1() {
function f2() {
return 5;
}
return f2;
}

let x = f1();
let p = x();
console.log§;

x calls func f1 which returns func f2, so is x a reference to func f2? and so p is calling func f2, right?

Yes, absolutely correct.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.