First off, all I'm trying to do is to structure my javascript code properly. I've been told I must not have anything global. So I took the 2 types of namespaces declaration from this answer and now asking you guys for the pros and cons of each.
    var namespace1 = new function () {
        var internalFunction = function () {
        };
        this.publicFunction = function () {
        };
    };
    var namespace2 = {
        publicFunction: function () {
        }
    };
Also, how do i have a private function in the last one namespace2?
 
     
     
     
     
    