Ok, we can have private identifiers in javascript, but what about protected ones?
问题 Simple as that, can we emulate the "protected" visibility in Javascript somehow? 回答1: Do this: /* Note: Do not break/touch this object */ ...code... Or a bit of google found this on the first page: http://blog.blanquera.com/2009/03/javascript-protected-methods-and.html 回答2: Sure you can. Here's another example. 回答3: What could that possibly mean? You don't have classes . I suppose you could analyze caller to determine whether it meets some set of criteria for being permitted to call a method.