undefined behaviour with an un intialised member variable in javascript
<p>It's 20:30 and I'm after a 6 hour bug hunt of an irritating bug caused by an uninitialized member variable.</p>

<p>In the our previous version we had the next few lines of code:</p>

<pre><code>var aList = new Array;
for (var iDx=0; iDx &lt; nNumOfElements; iDx++)
{
    // Some code
    aList.nCount = someValue;   //This line
}

aList.sort(function(a, b) { return b.nCount - a.nCount ; });
</code></pre>

<p>In the last release someone accidentally removed the line with comment.
and there was no other initialization of the member variable nCount.</p>

<p>Some of our clients got a "Number expected" exception which is pretty obvious (in retrospect), strangely the error doesn't reproduce with our Q.A. nor 80% of our clients!</p>

<p>How can it be? is there any strict mode that we can run with that will find such pesky bugs? what is the difference between the clients that got the exception and ones that didn't (it's not browser version nor windows version)</p>

<p>(our system runs only on IE6+ in a special container which makes it hard for us to write the code in normal I.D.E.'s we pretty much write it all in notepad ++)</p>

<p>Thanks!</p>
