I was reading about the best methods to create objects in javascript and found an interesting solution here.
var Foo = function()
{
    var privateStaticMethod = function() {};
    var privateStaticVariable = "foo";
    var constructor = function Foo(foo, bar)
    {
        var privateMethod = function() {};
        this.publicMethod = function() {};
    };
    constructor.publicStaticMethod = function() {};
    return constructor;
}();
I have been playing with this structure but I was wondering how can I do a few things.
- How can I access - privateStaticVariableor- privateStaticMethodfrom within- constructor.publicStaticMethod?
- If I create a second public method like - constructor.secondPublicStaticMethod = function(){};, how can I access it from within- constructor.publicStaticMethod?
- If I was to instantiate this object, how could I access all static properties and methods from within - constructor?
 
     
    