Create "namespace" in $(document).ready(function() {..});
<pre><code>// first.js
$(document).ready(function() {
   var MyNamespace = {};
});

// second.js
$(document).ready(function() {
   console.log(MyNamespace);
});
</code></pre>

<p>Running this script I'm getting error <code>Uncaught ReferenceError: MyNamespace is not defined</code>. I suppose, I'm getting this error because definition of <code>MyNamespace</code> and <code>MyNamespace</code> calling are in different scopes. How do I solve this problem?</p>

<p>I need to create namespace inside $(document).ready() wrapper because functions in this namespace will use jQuery methods etc.</p>

<p>What is the best practice?</p>

<p>Thank you!</p>
