Javascript acting different in two different versions
<p>Let me display the code first and then try to explain the problem.</p>

<pre><code>function toggleButton(filter, button) {
    var buttonOn = false;

    if ( button.value === "ON" ) {
    buttonOn = true;
    }


    if ( buttonOn ) {
        button.value = "OFF";
        button.className = "btn_tgl btn_tgl_off";
    } 
    else {
        button.value = "ON";
        button.className = "btn_tgl btn_tgl_on";
    }

    checkItem();
}

function checkItem(alreadyGotStuff) {
    if(!alreadyGotStuff){
        do this
    }
    else{
        do that
    }
}
</code></pre>

<p>So the problem is this. In the trunk and production version of the program that uses this script, when the toggleButton makes its run and <code>checkItem();</code> is called, <code>alreadyGotStuff</code> is <code>undefined</code>. This is correct as I need it to be undefined so the first <code>if</code> statement will suceed and it will <code>do this</code>. There are other functions in the script that will make a call     <code>checkItem(true);</code>, thus the function will <code>do that</code>. In my development branch, when the call is <code>checkItem();</code>, the value is always true. It doesn't matter what browser I am using, and the script is exactly the same. Why is it passing <code>undefined</code> in one version, and staying <code>true</code> in the other? </p>

<p>Thanks</p>
