Published Jul 05 2018
If you have a number with a leading zero, like
02, how to remove that zero?
There are various ways.
The most explicit is to use
10 is the radix, and should be always specified to avoid inconsistencies across different browsers, although some engines work fine without it.
Another way is to use the
+ unary operator:
Those are the simplest solutions.
You can also go the regular expression route, like this:
I wrote an entire book on this topic 👇
I also got a super cool course 👇