var str='1250' ;
alert( Number(str) ); //Get 1250
alert(parseInt(str)); //Get 1250
var str1='00100';
alert( Number(str1) ); //Get 100
alert(parseInt(str1)); //Get 64
When the parseInt method starts with a number '00', it will be converted as a binary to decimal method, so it is recommended that the number method is best to convert string to int.
alert( Number(str) ); //Get 1250
alert(parseInt(str)); //Get 1250
var str1='00100';
alert( Number(str1) ); //Get 100
alert(parseInt(str1)); //Get 64
When the parseInt method starts with a number '00', it will be converted as a binary to decimal method, so it is recommended that the number method is best to convert string to int.