New issue
Advanced search Search tips

Issue 805394 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jan 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

parseInt() behaves weirdly when called repeatedly

Reported by joncaru...@gmail.com, Jan 24 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/63.0.3239.84 Chrome/63.0.3239.84 Safari/537.36

Steps to reproduce the problem:
['1', '1'].map(x => parseFloat(x))
['1', '1'].map(x => parseInt(x))
['1', '1'].map(parseFloat)
['1', '1'].map(parseInt)

What is the expected behavior?
[1, 1]
[1, 1]
[1, 1]
[1, 1]

What went wrong?
[1, 1]
[1, 1]
[1, 1]
[1, NaN]

Did this work before? N/A 

Chrome version: 63.0.3239.84  Channel: stable
OS Version: 16.04
Flash Version:
 

Comment 1 Deleted

Comment 2 by woxxom@gmail.com, Jan 24 2018

See https://bugs.chromium.org/p/v8/issues/detail?id=2402

    Not a bug, just a JavaScript "feature".
    arr.map(parseInt) calls parseInt as parseInt(arr[i], i). 
    So the index in the array is interpreted as the radix by parseInt.
    Hence the NaNs when the radix is 1 or 2.
Status: WontFix (was: Unconfirmed)

Sign in to add a comment