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 :)
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 :)
Actually, there is no way to do this because 000 is equivalent to 0! If you want to do some arithmatic operations then simply use 0. If you want to just output 000, then use it as a string.