Cleanest format for writing javascript objects
<p>What is the cleanest format for writing javascript objects?</p>

<p>Currently I write mine in the following format</p>

<pre><code>if (Namespace1 == null) var Namespace1 = {};
if (Namespace1.NameSpace2 == null) Namespace1.NameSpace2 = {};

Namespace1.NameSpace2.Class1 = function(param1,param2){
     // define private instance variables and their getters and setters
     var privateParam = param1;
     this.getPrivateParam = function() {return privateParam;}
     this.publicParam1 = param2;
}

Namespace1.Namespace2.Class1.prototype = {
     publicParam1:null,
     publicFunction1:function() {/* Function body*/}
}
</code></pre>

<p>That format works well right now, as the YUI documentation software is able to parse it, and the comments and give back good documentation.  But what it doesn't provide is a clean way to declare static global methods within the namespace.  I am also wondering if there is a cleaner way to declar private variables as well.</p>

<p>My question is, is anyone out there have a cleaner way of defining javascript objects than this, and if so, why is your method better?</p>

<p>Thanks!</p>
