In below code(Node.js), it prints 1 2
function count(){
var counter = 0
function inc(){
counter++
console.log(counter);
}
return inc
}
var x = count();
x()
x()
Does that means that variable counter
being available to inc()
due to closure will live lifetime of the program?