Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because you shouldn't try to be clever with Javascript.

Map passes 3 parameter to the mapped function, the second one being an index, and parseInt accepts a second optional argument as radix.

be explicit:

    ["1","2","3"].map(function(x){return parseInt(x,10)})

Javascript isn't the problem here.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: