how come a variables value within the immediate scope of an iife, survives in a similar way to a global variable in terms of holding it's value. This is really confusing me.
(function(){
    var display = document.getElementById('display');
    var button = document.getElementById('button');
    var count = 0;
    display.innerHTML = 0;
    button.onclick = function(){
        count ++;
        display.innerHTML = count;
    }
})();
 
     
     
    