How do I find out how many times a function is called with javascript/jquery?
<p>Perhaps an odd question but here it goes: I have a function which I call periodically and within that function I need to know which iteration I'm in, or how many times the function has been called. A simplified version of the problem: </p>

<pre><code>jQuery( document ).ready( function(){
    setInterval( "myFunction()", 3000 );
});

function myFunction()
{
    alert( "I have been called X times" );
}
</code></pre>

<p>So, how do I figure out the X in the above code?</p>
