function outer() {
let xx = 0;
function inner(fun) {
console.log(fun());
fun();
return "ds";
}
return inner;
}
const x = outer();
function fun() {
xx++;
return xx;
}
const y = x(fun);
console.log(y);
here the function fun() is called inside a closure function so it should have the data of its static content that is lexical scope and should have values of xx but it is giving reference error please anyone explain me why this is happening.
please anyone explain me why this is happening.