JS Calculator review


I like the fact that you included parentheses; looks and functions great.

When I type into the input field directly and then click on the = button or press “Enter” on my keyboard nothing happens. One way to get around this is just eliminate the option for the user to input directly into the input field or add the said missing functionality to the calculator.

Also this happens: 0.1 + 0.2 = 0.30000000000000004 , the solution to this is StackOverflow’able but I also encourage you to find out why it happens. :smiley:

You’re getting there my friend!

Added “readonly” attribute to the input field and used ans.toPrecision(1) if the eval answer was less than one. Not very elegant but appears to work solving the floating math issue. Thanks for your comments!

Thanks for your comments!