Using jquery variable outside of $(document).ready
<p>I am using jQuery and I have 2 different js files.</p>

<p><strong>file_1.js</strong></p>

<pre><code>$(document).ready(function(){
    var A = 'varA';
});
</code></pre>

<p><strong>file_2.js</strong></p>

<pre><code>$(document).ready(function(){
    console.log(A); // will get an A is undefined because of this closure thing
});
</code></pre>

<p>Is there any way to access one variable from one file from another file?
I need all the code to be inside $(document).ready(...)</p>

<p>One solution, I used is to make variable global (without using var A)
Is there anything better?</p>
