4 ms·
Also, no reason to write extra characters just to prevent people from using hexadecimal, it's often convenient and it comes for free!
by jakear 4y ago
Also, no reason to write extra characters just to prevent people from using hexadecimal, it's often convenient and it comes for free!
- mseepgood 4y agoOctal is sneakier than hexadecimal, especially if the values are from user input. ['07', '08', '09'].map(val => parseInt(val)) // => [7, 0, 0]
- benatkin 4y agowas ['07', '08', '09'].map(val => parseInt(val)) // => [7, 8, 9]
- jakear 4y agoHasn't been an issue in around a decade: https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/parseint#browser_compatibility https://developer.mozilla.org/en-US/docs/web/javascript/refe...
- deleted 4y ago[deleted]
- benatkin 4y agoPlus there's this if you really want to support old browsers: https://github.com/zloirock/core-js/blob/ce52fdc735c5c809c9e85b2072f92d41b5a3885a/packages/core-js/internals/number-parse-int.js https://github.com/zloirock/core-js/blob/ce52fdc735c5c809c9e...