4 ms·
I just wrote this line about two hours ago and my tests weren't thorough enough to catch the bug it introduced. Just when I thought I knew JavaScript. Thanks fo
by nathansobo 13y ago
I just wrote this line about two hours ago and my tests weren't thorough enough to catch the bug it introduced. Just when I thought I knew JavaScript. Thanks for saving me some time.
- iamthepieman 13y agoI'm sure you know this by now but you can keep the syntax and use Number instead xs.parseInt(Number)
- matb33 13y agoI think xs.map(Math.floor) takes the cake if I recall speed tests properly
- bsder 13y agoAlways give the base to parseInt in Javascript. Always. The moment you don't, all kinds of bugs follow. I have to go cry now at the number of times this has bitten me.
- TazeTSchnitzel 13y agoAre there any other problems aside from octal?
- ajanuary 13y agoNot just javascript, a whole bunch of language's parseInt implementation will interpret the base from a leading zero etc.
- _random_ 12y agoAlways remember - it's not a language but a loosely parsable texty thing.