2 ms·
Can you explain that one? Does it have something to do with parseInt being able to take more than parameter?
by heinrich5991 11y ago
Can you explain that one? Does it have something to do with parseInt being able to take more than parameter?
- fulafel 11y agoArray.map does not work like map in other languages. They decided that map shall receive the array index as the second argument, and there's also a third argument that does something else. JS happily mashes these 3 arguments into parseInt's argument list of (stringValue, radix) without error. Hilarity ensues. (This code also sins against "never call parseInt without the radix argument", see point about too many minefields to remember at once)
- nly 11y agoSeems to me the answer here would be to bind the radix argument of parseInt with a wrapper before applying map