Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have string "000" and I want to convert it to a number 000.
parseInt and Number parse it to 0.
I try this:
const number = '0000'; const parseNumber = parseInt(number, 10); console.log(parseNumber); // the output is 0 :/
thanks :)
0000
000
Actually, there is no way to do this because 000 is equivalent to 0! If you want to do some arithmetic operations then simply use 0. If you want to just output 000, then use it as a string.
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
0000, not000.