Today, I was troubled by a problem. One page runs well on a browser (whether on a mobile phone or a PC), and a problem occurs through webview. There are two problems worth computing. Then, through alert, this value is displayed, and it is found that the calculation result is much different from that on the browser. Originally, it is a positive number, but it turns into a negative number. After careful comparison, we find that some of the numbers are erased, and these numbers are converted from strings through parseint. The only difference between erased values and other normal numbers is that they all start with 0, for example, "04903", while other values are "90874 ". The reason is obvious,The javascript parseint supported by webview converts all strings starting with 0 to 0.It is easier to solve the problem. You can write a str2int method instead of parseint.
Str2int: function (STR) {STR = Str. replace (/^ 0 +/g, ''); If (Str. length = 0) {return 0;} return parseint (STR );}