Feedback Please for JS Calculator!

Feedback Please for JS Calculator!
0

#1

Here’s the calculator and here’s the code.

I’m particularly keen for possibilities to refactor my code. Thanks :slight_smile: !


#2

It looks good and works fine!
Unfortunately I cannot look at your code because I haven’t done the project yet.
cheers


#3

If I enter 1 / 3 = * 3, I expect to see 1, not 0.999999999. Also, if I enter 1 / 3 * 3, I expect to see 1 and not Infinity.


#4

Thank you for catching that!

Do you have any recommendations for how to deal with floats and digit limits?

FCC’s JavaScript calculator seems to rounds things to the hundredths place, and 1 / 3 * 3 gives 0.99. The display also has a string length limit of 9 characters.

In my case, floats will show 11 digits (the display length limit) minus the length of the numbers before the decimal and the decimal. For example, 23.452318268 would show 23.45231826.

I’d like to do better but I’m not sure how to find an elegant compromise.