Javascript The conversion of strings and numbers is so flexible, I feel that I can't go back to pascal
int conversion string:
1,var str=String(int);
2,num.toString(param); // param is the basis eg: var num=100; num.toString(16); result= $64h;
3,num.toFixed(param); // param is the number of decimal places (and also brings carry, which is very easy to use). eg: var num=100; num.toString(1); result=100.0;
4,num.toExponential(param); // Exponential form. eg:var i=100; i.toExponential(1) result= 1.0e+2; 5,num.toPrecision(param); // If the number of digits is greater than param, the exponential form is displayed. If it is less than param, the normal character form is displayed;
string to int:
1, var int=number(str); // Cannot convert numeric strings with spaces; if you cannot convert, you can directly NaN
2, var int = parseInt(str,param); // param refers to how much str is in the binary number. eg: var num=parsetInt(100,16); num=256; If str has space or non-numeric placeholder, start from the first bit and count as much as it can be converted. If even one bit cannot be converted, it can only be NaN.
The above brief discussion on InttoStr and StrtoInt in js is all the content I have shared with you. I hope it can give you a reference and I hope you can support Wulin.com more.