global variable in javascript?
<p>i have this code:</p>

<pre><code>    $(".link").each(function() {
            group += 1;
            text += 1;
            var links = [];
            links[group] = [];

            links[group][text] = $(this).val();
        }
    });

    var jsonLinks = $.toJSON(links);
</code></pre>

<p>after it has looped every .link it will exit the each loop and encode the array 'links' to json. but the array 'links' is a local variable inside the each-loop. how can i make it global outside the loop?</p>
