W
W
wakenbyWork2021-06-18 10:32:31
JavaScript
wakenbyWork, 2021-06-18 10:32:31

How to remove 0 at the beginning of a number?

I'm trying to write a filter for input so that only numbers in a certain range can be entered there. And the problem is that numbers like: 0100pass ((

How can you convert numbers to such?

020=> 20
0100=> 100

And if there is one 0, then leave one 0:

0=>0

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nedosekinstanislav, 2021-06-18
@wakenbyWork

parseInt()
but it takes a string, you can convert the received value to String(value)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question