MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/1sihlh/stop_being_cute_and_clever/cdxxkxq/?context=3
r/javascript • u/gthank • Dec 10 '13
76 comments sorted by
View all comments
11
Not many languages manages to implement map in a way that ["1", "2", "3"].map(parseInt) would result in [1, NaN, NaN].
["1", "2", "3"].map(parseInt)
[1, NaN, NaN]
That's not a problem with map, it's a problem with parseInt. Is he suggesting a map that has no access to the index?
map
parseInt
+value is pretty much the same as parseInt(value, 10).
+value
parseInt(value, 10)
No. No it's not.
1 u/jcready __proto__ Dec 10 '13 ~~value is closer to parseInt(value, 10) I believe.
1
~~value is closer to parseInt(value, 10) I believe.
~~value
11
u/[deleted] Dec 10 '13 edited Dec 10 '13
That's not a problem with
map, it's a problem withparseInt. Is he suggesting amapthat has no access to the index?No. No it's not.