javascript| function
Recently I was upgrading a calendar control, there are some inexplicable errors, and finally found that the original is a parseint function of a so-called bug caused by the parseint ("08") and parseint ("09") to return when processing is incredibly 0, and There is no such thing as a parsefloat function, and I have changed all the places I used to the parseint function to the parsefloat function.
Finally after the test found that the original when there are 0 of the time, parseint default to it as octal processing, 01--07 natural no problem, but 09,08 are unqualified octal form, so was treated in accordance with 0. To solve this problem, you can take advantage of another parameter of the parseint function, which is shown to tell parseint to be processed in decimal. For example we can do this parseint ("08", 10) or parseint ("09", 10). This will not be a problem. So the so-called bug should not be called as a bug, but we do not know much about it, ignoring an important parameter, just appeared this let us headache situation.