js add comma at Sextillion values
<p>I use one small code js to add comma to value:</p>

<pre><code>function addCommas(nStr)
{
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length &gt; 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
    return x1 + x2;
}
</code></pre>

<p>I have problem when try to add comma to big values like sextillion values.
Eg.</p>

<pre><code>addCommas(1000000) //return correct "1,000,000"
</code></pre>

<p>but if use big values like this</p>

<pre><code>addCommas(50949024266983356472874) // return wrong "5.094902426698335e+22"
</code></pre>

<p>What or where I do wrong?</p>
