I was working on a project for a while, trying to figure out what I was doing wrong, when I finally narrowed \"the bug\" down to the fact that the below code doesn\'t work a
When you call a non-member function (not called as someObject.method()), it runs in the context of the window. It doesn't matter whether it's a private function or a global one.
You could do:
Beta.call(this);
call allows you to call a function while passing a context as the first argument (apply is similar, but the argument list is an array).
However, I'm not clear (even for the trivial example) why onion is public but Beta is private.