If you want to remove leading zeros from a number in JavaScript , you can use the parseInt() method.
How to remove leading zeros from a number in JavaScript?
Here’s an example demonstrating how you can use parseInt() function to delete leading zeros.
<!DOCTYPE html> <html> <body> <script> var number1 = parseInt("034", 10); document.write(number1); </script> </body> </html>
The output of the above program is
34
Leave a Reply