DEV Community

Discussion on: JavaScript/Typescript Tips compilation 2021🚀

Collapse
 
mistval profile image
Randall • Edited

I agree, + to convert something to a number is a hack. It also converts empty string to 0, which can lead to bugs. Better to use Number.parseInt() (or parseFloat) and then do a NaN check.