How can I check if number is exponential? I have a case in my code when adding or multiply integers, when usual number gets converted to exponential.
A rough example - 10000000*100000000000000000 will return 1e+24.
Convert to a string and check for e.
let num = 10000000;
console.log(num.toString().includes('e'));
num *= 100000000000000000;
console.log(num.toString().includes('e'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With