We often use the ParseInt function to convert strings into int values. The ParseInt function has two parameters that can be set, and the second parameter can be defaulted.
ParseInt("string", base used)
var num1=ParseInt("10",2)///2
var num1=ParseInt("10",8)///8
var num1=ParseInt("10",10)//10
var num1=ParseInt("10",16)//16
The base parameters are optional: 16, 8, 10, and 2.
We usually use base 10. It is best to always use the second parameter and set it to 10. If there is no second parameter, the function will decide how to choose the base. (Problems may occur, for example, "070" is considered octal by ECMAScript 3 and decimal by ECMAScript 5)