4 ms·
I have never seen a browser that requires the radix, and MDN specifically calls out that you should pass both arguments or you will get unexpected results. The
by reificator 9y ago
I have never seen a browser that requires the radix, and MDN specifically calls out that you should pass both arguments or you will get unexpected results. They wouldn't need to do that if the radix was required.
Now, should you treat the radix as optional? Absolutely not. I've got several commits on newly adopted codebases where I went through and explicitly used `10` as the radix anywhere `parseInt` was called. But is it technically optional? Absolutely.
Proof: https://i.imgur.com/BnAiN8s.png https://i.imgur.com/BnAiN8s.png