Shouldn't the first example also return `[11,55]` ...
# random
p
Shouldn't the first example also return
[11,55]
?
k
Not sure what's going on but I guess that's another reason to always specify the radix as told here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt 🙂
a
Yup
Array.map
runs the callback with two arguments, val, positionInArray, and `parseInt("55", 1) returns NaN
a
The actual problem is "11::55".split(':') returns
["11", "", "55"]
Or actually, no. Strike that.
["11",  "55"].map(parseInt)
doesn't work either. My bad.
p
Thanks all 🙂 Even though shortly after I posted this, I found out the reason why.. its interesting to see that this very specific problem is listed under tricky use cases for map in mozilla docs
h
javascript™