Even though JS doesn't have language constructs for public/private, there are a number of different ways to write modules with hidden members by use of closures.
Crockford explains with some examples here:
Crockford explains with some examples here:
It just took programmers collectively over 10 years to figure it out. I blame the 'new' keyword in JS, it feels completely grafted on after the fact.
Lua has been using this method of designing modular programs for years.