JavaScript to trim started 0 in a string
<p>I hava a time string,the format is HHMM, I need to get the decimal of it, how can I do ?</p>

<p>e.g.</p>

<p>'1221'=1221 </p>

<p>'0101'=101</p>

<p>'0011'=11</p>

<p>'0001'=1 </p>

<p>If the string begins with "0x", the radix is 16 (hexadecimal)</p>

<p>If the string begins with "0", the radix is 8 (octal). </p>

<p>But I want to treat it as decimal no matter whether started with 0 or 00 or 000.</p>

<p><hr /></p>

<p>additional:</p>

<p>thanks all. </p>

<p>I had know what you said, what make I confused as following :</p>

<p>var temp1=0300;
var temp2='0300';</p>

<p>parseInt(temp1,10)=192;
parseInt(temp1,10)=300;</p>

<p>so I I doubt parseInt() and have this question .</p>
