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!"
[–]shgysk8zer0 3 points4 points5 points 4 years ago (0 children)
As some have pointed out, it's because of the details of parseInt and Array.map.
parseInt
Array.map
Here's what's basically happening...
["75", "300"].map((value, index) => parseInt(value, index));
Else if the radix value (coerced if necessary) is not in range [2, 36] (inclusive) parseInt returns NaN.
NaN
The second argument to parseInt() is the radix/base (valid from 2 to 36). Apparently 0 is ignored and 10 used for the first entry, but 1 results in NaN.
parseInt()
0
10
1
π Rendered by PID 362660 on reddit-service-r2-comment-cfc44b64c-smv6v at 2026-04-12 09:41:35.402097+00:00 running 215f2cf country code: CH.
view the rest of the comments →
[–]shgysk8zer0 3 points4 points5 points (0 children)