Feedback Please for JS Calculator!

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

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

1 Like

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

1 Like

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.

1 Like

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.