How to return a value from a nested and anonymous function?
<p>I have this JS code:</p>

<pre><code>function paging() { 
    $('.paging li').click(function(e) {
        $('.paging li a').removeClass("active");
        $(this).find('a').addClass("active");
        $('#img-grp-wrap img').hide();

        var indexer = $(this).index(); 
        $('#img-grp-wrap img:eq('+indexer+')').fadeIn();    

        e.preventDefault();
        return indexer;
    });
}

var $cur_page = paging();
console.log($cur_page);
</code></pre>

<p>I would like to use the indexer value outside the function paging() but when I try doing console.log(), it just says <em>undefined</em>.</p>

<p>How do I structure this so that I can pass the index value of the link I clicked outside the function (which is the indexer variable)?</p>

<p>I'm a programming newbie so please bear with me.</p>
