How to remove leading zeros from a number in JavaScript?

Sometimes, we want to remove leading zeros from a number in JavaScript.

In this article, we’ll look at how to remove leading zeros from a number in JavaScript.

How to remove leading zeros from a number in JavaScript?

To remove leading zeros from a number in JavaScript, we can use the Number function.

For instance, we write

const numString = "065";
number = Number(numString);
console.log(number);

to call Number with numString to return the number converted from numString.

The leading zeroes in the string will be dropped.

Conclusion

To remove leading zeros from a number in JavaScript, we can use the Number function.