I have some zeros prior to a positive integer. I want to remove the zeros so only the positive integer remains. Like '001' will only be '1'. I thought the easiest way was to use parseInt('001'). But what I discovered is that it don't works for the number 8 and 9. Example parseInt('008') will result in '0' instead of '8'.
Here are the whole html code:
<html> <body>
<script>
var integer = parseInt('002');
document.write(integer);
</script>
</body> </html>
But can I somehow report this problem? Do anyone know an another easy workaround this problem?
parseInt('008').toString()
is very clumsy, consider usingRegExp
instead – Otiliaotina