Dealing with integer number leading with 0(s) in JavaScript
parseInt(012, 10)
// 10
parseInt(05, 10)
// 5
Interesting, huh? That’s because js would treat number leading with zero(s) as octal numeral, so we need to convert it into decimal number and treat it as string. So here is my solution:
// num = 0120
var...
blog.lbj.moe1 min read