Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping with parseInt over arrays #211

Open
adrfantini opened this issue Jun 17, 2021 · 1 comment
Open

Mapping with parseInt over arrays #211

adrfantini opened this issue Jun 17, 2021 · 1 comment
Labels
new-example A proposal of the new example

Comments

@adrfantini
Copy link

I feel like this classic gem should also be included (if it is not there already and I missed it):

[1,2,3].map(parseInt)
// [ 1, NaN, NaN ]

Explanation:
map passes three arguments to parseInt for each iteration, and parseInt accepts the second argument (undefined) as radix, and fails silently. [1,2,3].map((x) => parseInt(x)) works.

Links:

Doc:

@adrfantini adrfantini added the new-example A proposal of the new example label Jun 17, 2021
@denysdovhan
Copy link
Owner

Could you send a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-example A proposal of the new example
Projects
None yet
Development

No branches or pull requests

2 participants