Passing a variable to a self invoking function
<p>I have an AJAX request and in the success handler, to be able to grab the data anywhere I pass it to a function, called <code>dataHandler</code>. From there I handle what I need and end up with an array of items.</p>

<pre><code>function dataHandler() {
    var myArray = ["21/06/2016"];
}
</code></pre>

<p>I'm trying to pass what i've got in the <code>dataHandler()</code> function to another function that is self invoking but if I named the function like <code>$(function myName(){}</code> then in my first function did <code>myName(myArray);</code> I still can't access the data.</p>

<pre><code>$(function() {
    console.log(myArray);
})
</code></pre>

<p>How can I pass a variable from a normal function to a self invoking function?</p>