JavaScript Number preserve leading 0

Represent them as a String. Outside of strict mode, a leading zero denotes an octal number otherwise.

Also, why would a leading zero have any significance when calculating numbers? Just use parseInt(num, 10) if you need to.

Leave a Comment