They are “protected” in the sense that only code in the lexical area of the closure can directly access variables of the scope function. I recommend reading notes on closing gossip in general.
Any leaked object can still enter a data manipulation point / side effect. Closing in ECMAScript is no more "secure" than in any other language with similar closing semantics - in this sense, "safe" means "access to a private variable". On the other hand, some languages already have more controlled member visibility modifiers (like Java or C # with private / public differences).
This, of course, if you consider JavaScript objects that “just” rely on prototypes as “unsafe”. (If someone misuses my code, let them - and if it breaks, let them burn ;-)
Personally, I find Mr. Crockford a wonderful evangelist, but not for my religion ;-) You can say all kinds of good things about X, without properly analyzing it in relation to Y.
user166390
source share