When I run the program and put in my values it prints out the 5 year number in a brownish color under the command.log I want to use. Not sure how to stop it or what’s causing it. I imagine it has something to do with the code calculating the compounding interest. thanks in advance.
If you mean
then this is just part of replit finishing running a node.js repl
I should have included a picture to be more specific.
Oh, you mean precision errors. It does have to do with calculating the interest. Basically, computers cannot accurately store information floats, only very close. Try rounding to 2 decimal places
console.log(num.toFixed(2));
You have an extra console.log
at the end of your code if that’s what your refering to.
I was trying to figure out how to round my number like that, thanks for the tip about precision errors.
This was actually the cause, no idea how I missed it, thanks.
You’d be surprised how often you can miss things like that. Sometimes I’ll have an error and be tryna figure out what’s causing it for like an hour only to eventually figure out I missed an operator or something obvious like that
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.