Convert numbers into comma separated format with two decimals in javascript
<p>I am trying to convert numbers into comma separated format with two decimal places for each and every number in javascript:</p>

<p>My code:</p>

<pre><code>Number(parseFloat(n).toFixed(2)).toLocaleString('en');
</code></pre>

<p>This code doesn't show two decimal places (.00) for whole numbers.</p>

<p>I am expecting following results for a set of numbers:</p>

<pre><code>10000 =&gt; 100,00.00
123233.12 =&gt; 123,233.12
300000.5  =&gt; 300,000.50
</code></pre>

<p>Appreciate your answer, thanks.</p>