Why is typeof my variable an object, and not a number
<p>I have a table which has a couple cells that contain simple numbers (IE: 1.00, 1000.00, 10000.00). I'm trying to format the cell contents using the 'format' function below. I have had success with this function in a different area of my code, but for whatever reason (the reason why I'm here) when I try to feed the contents of the table cells in, it doesn't work as I expected. </p>

<p>The problem is that the typeof my cell contents is 'object' and not 'number', so it skates right by the if statement and just returns my original value back to me. Is there a way I can coerce the data to be typeof number? I thought <code>var n = new Number(cellText);</code> would do the trick,  however, the typeof comes back as object. Confused. </p>

<p>In globalize.js: </p>

<pre><code>Globalize.format = function( value, format, cultureSelector ) {
    culture = this.findClosestCulture( cultureSelector );
    if ( value instanceof Date ) {
        value = formatDate( value, format, culture );
    }
    else if ( typeof value === "number" ) {
        value = formatNumber( value, format, culture );
    }
    return value;
};
</code></pre>

<p>In my page: </p>

<pre><code>$(document).ready(function () {
    $('td[globalize="true"]').each(function () {
        var $this = $(this);
        var cellText = $this.text();
        if (cellText != null) {
            var n = new Number(cellText);
            var v = Globalize.formatNumber(n, _gloNum[0]);
            $this.text(v);
        }
    })
});
</code></pre>
