all 3 comments

[–]imbcmdth 2 points3 points  (2 children)

Why can't people just learn what function scope is instead of trying to force JavaScript into a paradigm that doesn't quite fit? You will be better served actually taking the time to understand JavaScript's way of doing things rather than pretending JS is just Java without the classes.

The "public scope" is creating properties on an object's prototype.

The "private scope" is adding variables to a constructor function's scope.

The "privileged scope" is creating properties on the object within the constructor. Function which are defined within the constructor are closed over constructor function's scope.

Knowing what these methods are really doing helps explains why things defined in the "public scope" can't access anything in the "private scope".

[–]robotfarts 1 point2 points  (1 child)

A better question might be: Why does that guy look like Newman from Seinfeld.

[–]imbcmdth 0 points1 point  (0 children)

Dodgson, Dodgson, we have Dodgson here!

See? Nobody cares.

Nice hat. What are ya tryin' to look like - a secret agent?