My question is why the following code prints 1 instead of 500; When the callback is invoked and it doesnt find the variable count, doesnt it first looked at the context of func1 ?
function func1(cb){
let count = 500
cb()
}
let count = 1
function func2() {
console.log(count);
}
func1(func2)