How to Search

Let me paint a picture for you. Let’s say you are working on a JavaScript program in which you get a date as a string (for example, '2014-10-08'), and you want to know what the next day is. You already know that you can convert from string to number using parseInt, so you use that (see Listing 13.1). Everything is going great. Then one day you notice that your program is producing some really strange results, but only in older versions of Internet Explorer: Your program thinks the day after '2014-10-08' is '2014-10-01', not '2014-10-09'. You set some breakpoints and step through your code, and you find that parseInt seems to be broken: When the argument is '08', you get 8 on most browsers, but you get 0 in Internet Explorer (see ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.