Vanilla JS Calcualtor (WOIP)

Hello, I’d like to hear some feedback about this calculator I built with JS.


(Best viewed on full screen or mobile)

I made it after reading a bit about JS events. Instead of simply using eval() I wanted to add some error prevention rules as well.
It works both with the on screen buttons and keyboard input.

There’s one thing remaining of what I wanted to do, if anyone have any idea on how to tackle it, it would be more than welcome. Here’s the thing:
I want to make the numbers on the display screen overflow to the left instead of the right, so the user is not limited but input length and can actually see the latest input number. I’ve tried using direction: rtl; and setting the element as bidirectional input and while it works for the numbers it has problems displaying the symbols.

P.S.: I have yet to got to refactoring the code, but really, any criticism is welcome.

Thanks.

1 Like