I tried to make my own implementation of a click counter. It works, but I dont understand how the store variable, which literally stores the closure for abc(), at a time when count=0, is able to edit the value of count in the closure, every time that it is called. Isn't it supposed to be an immutable snapshot?
function xyz(){
    let count=0;
    function abc(){
        return ++count;    
    }
    
    return abc;
}
var store = xyz();
document.addEventListener('click',()=>{
    console.log(store());
});
