Javascript Convert Number into given format
<p>I got requirement of the java-script Number formatting like below</p>

<p>I need one function its having 2 parameters like</p>

<pre><code>var number = 1000;
var format = #,###.0; //or #,### ; 

function ConvertNumber(number, format){   
    // this function need to return 1,000.0 if format is #,###.0
    // this function need to return 1,000 if format is #,### 
}
</code></pre>

<p>can anyone having this kind of function?
your help is really appreciated  thanks </p>
