Hacker News new | past | comments | ask | show | jobs | submit login

Spoiler: because `parseInt` accepts the second argument of the radix of the number to parse, and `map` calls the provided callback function with a second argument of the index in the array, so this is the result of calling `[parseInt("1",0), parseInt("2",1), parseInt("3",2)]`

The article is from 2011, and I'm not even sure arrow functions were in the spec at that time. Nowadays the best practice would be: `["1," "2", "3"].map(maybeNum => parseInt(maybeNum))`




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: