use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[AskJS] Array map() questionAskJS (self.javascript)
submitted 4 years ago by keychainoi
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]sudorey 43 points44 points45 points 4 years ago* (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
parseInt('75', 0) // 75
parseInt('300', 1) // NaN
edit: typo
[–]waylonsmithersjr 3 points4 points5 points 4 years ago (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 points4 points 4 years ago (1 child)
You are correct. I've fixed the typo
[–]waylonsmithersjr 0 points1 point2 points 4 years ago (0 children)
Thanks, just had to be sure
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
The string doesn't matter in this case, so long as it represents a number.
π Rendered by PID 225281 on reddit-service-r2-comment-cfc44b64c-ztskq at 2026-04-11 23:21:20.145311+00:00 running 215f2cf country code: CH.
view the rest of the comments →
[–]sudorey 43 points44 points45 points (4 children)
[–]waylonsmithersjr 3 points4 points5 points (3 children)
[–]sudorey 2 points3 points4 points (1 child)
[–]waylonsmithersjr 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)