When I was working on a project today, I encountered a problem. I needed to convert a String type variable into an int type. As usual, I wrote var i = Integer.parseInt("112"); but the console reported an error saying "'Integer' is undefined". Later, I learned that the conversion of String to int in js is different from that in Java, and you cannot directly use the conversion from Java to js. Change it to var j = parseInt("11"); and it will be ok.
Remarks: Whether it is Java or JavaScript, the parseInt method has two parameters. The first parameter is the object to be converted, and the second parameter is the base, which can be 2, 8, 10, 16. The default is Decimal processing. But in JavaScript, numbers starting from 0 are considered to be processed using octal system, and numbers starting from 0x are considered to be processed using hexadecimal system