I have a basic understanding of IIFEs and protected/private/static values. As I'm learning about JS, I notice IIFEs being mentioned to keep variables and functions "protected." I also notice the same thing for PHP classes, like setting a property to protected or private.
But why would any of this be done in a real situation? Wouldn't NOT ACCESSING the variables or NOT ACCESSING the class properties have the same effect?
Bonus, also why use let and const for ES6 scoping, when you just don't have to access the variable?