Answer the question
In order to leave comments, you need to log in
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: 0100
pass ((
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
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 questionAsk a Question
731 491 924 answers to any question