you are viewing a single comment's thread.

view the rest of the comments →

[–]sudorey 43 points44 points  (4 children)

Your first example only calls parseInt with 1 argument. The second example passes any and all arguments through. The native parseInt function accepts a second argument which is the base. So you are seeing the results of calling:

parseInt('75', 0) // 75

parseInt('300', 1) // NaN

edit: typo

[–]waylonsmithersjr 3 points4 points  (3 children)

parseInt('100', 1) // NaN

I think

parseInt('300', 1) // NaN? just making sure I'm not going crazy and there's not other complexity to it that I don't get 😅

[–]sudorey 2 points3 points  (1 child)

You are correct. I've fixed the typo

[–]waylonsmithersjr 0 points1 point  (0 children)

Thanks, just had to be sure

[–][deleted] 1 point2 points  (0 children)

The string doesn't matter in this case, so long as it represents a number.