remove leading zero from string in javascript

This is especially useful when you want to format phone numbers by removing the leading zero.

const num = '08084764545';

const removeLeadingZero = parseInt(num, 10);
console.log(removeLeadingZero); // ?️ 8084764545

JavaScript String Cheatsheet Reference

Leave a Reply

Your email address will not be published. Required fields are marked *