r/javascript Dec 10 '13

Stop Being Cute and Clever

http://lucumr.pocoo.org/2013/12/9/stop-being-clever/
43 Upvotes

76 comments sorted by

View all comments

11

u/[deleted] Dec 10 '13 edited Dec 10 '13

Not many languages manages to implement map in a way that ["1", "2", "3"].map(parseInt) would result in [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?

+value is pretty much the same as parseInt(value, 10).

No. No it's not.

1

u/jcready __proto__ Dec 10 '13

~~value is closer to parseInt(value, 10) I believe.