Cost of creating objects in JavaScript/JQuery
<p>Could someone please compare and contrast between the costs of creating objects in JavaScript/JQuery and a simple variable declaration? </p>

<p>For Example:</p>

<pre><code>var G = {}
G.obj = (function(){
        var x = 10; //'private' attribute, can be accessed internally only
        G.y   = 20; //'public'  property
        });
</code></pre>

<p>x obviously has a local scope where as Y would be accessible publicly through <strong>G</strong> with a selector. Are there any significant overheads involved in the latter approach? </p>

<p>Thanks.</p>

<p>Edit: I realize this might sound like a silly question but I am planning an architecture for an HTML5 game, I have to keep little things like these in mind as I move forward.</p>
