3 ms·
My point is that specifying the radix is a best practice: there are still a number of situations where it's unnecessary for properly functioning code (ie: if yo
by nbpoole 15y ago
My point is that specifying the radix is a best practice: there are still a number of situations where it's unnecessary for properly functioning code (ie: if you aren't using zero-padded numbers). Specifying the radix certainly helps readability, but you can't just do a regex search and say that all the code it finds is buggy.
On the other hand, casting Math.random() to an int is wrong unless you're trying to express 0 in an obfuscated way.
- podperson 15y agoAgreed. If you're calling parseInt on a variable it's simply not a bug. parseInt(1) seems like a whole different class of bug to me :-)