How to get exact digits of number 0.01239e-5 in Javascript?

Hello everyone!

How can I get the exact digits of the number 0.01239e-5 or any similar numbers? I came across this function and tried it:

function financial(x) {
return Number.parseFloat(x).toFixed(100);
}
console.log(financial(‘0.01239e-5’));

This outputs 0.0000001238999999999999911110383846168936372578173177316784858703613281250000000000000000000000000000. Actually, I want to get the figures 0.000000123899999999999991111038384616893637257817317731678485870361328125. As I used the function, it needs a number in toFixed(), but I don’t want anything to be added. How can I fix this?

Hello,
A simple solution to remove the extra zeros at the end of your output is to use a regular expression to detect the zeros at the end then remove them

function financial(x) {
return Number.parseFloat(x).toFixed(100).replace(/0+$/, "");
}

console.log(financial(0.01239e-5));

Thank you for your reply, I will give your solution a try. However, I used BigNumber and it worked for me:

<script src='https://cdn.jsdelivr.net/npm/bignumber.js@9.1.2/bignumber.min.js'></script>
var number = 0.01239e-5
var get_number = BigNumber(number).toFixed()
console.log(get_number)