Javascript calcular - feedback greatly appreciated

Howdy Campers!

I would greatly appreciate any feedback on my Javascript calculator:
https://codepen.io/cakeisaliegaming/full/ZEBpbjO

I created this app for the Build a JavaScript Calculator Front End Libraries Project.

I found this project quite challenging and I perhaps bit off more than I could chew with my “stretch goals”.

Specifically, I wanted to complete the project without using eval() and I also wanted to include:

  • a formula display with a customised scrollbar
  • comma separation of digits
  • a del/backspace button
  • a max digit limit (21)
  • a proper pos/neg button (as opposed to just using the subtract key)
  • keyboard controls

So, I’ve spent several weeks working on this project and much of the time was spent fixing various bugs and unintended behaviours. I’m sure there are still some I’ve missed!

I feel that some of my implementations may be somewhat clumsy/messy or sub-optimum. On the plus side, I found this project to be a good refresher for regex and using replace().

Anyway, I would appreciate any feedback and please let me know of any bugs. Thanks!

1 Like

Looks really good. I just finished this project as well and respect how difficult this can be. Good responsiveness and like the extra functionality.

1 Like

Thanks. It has certainly been a learning experience!

You’ve done an amazing work! I’ve checked your other project too, and they look really good. I am too stuck in calculator project. 4 days so far, I still fighting with the logic of parsing ans displying the formula. Anyway, too much frustration when things don’t work, but great pleasure when you see your work do what is supposed to do :slight_smile:

1 Like

Thanks for the kind words! Yeah, I definitely had some stressful moments coding the calculator, but it’s also very rewarding when you solve the issues and get things working properly.

Do you have a forum thread for your calculator? I could have a look if you’re completely stuck, although I’m not sure how much help I’d be as I’m far from being an expert!

Anyway, good luck with your project!

1 Like

Finally I finished mine :grinning: It is passing all the tests and I am very satisfied despite the spaghetti code I have created :joy: . I advise you not to look inside for fear to have a heart attack :smiley:
Link to codepen

1 Like

Ah, cool! I like the colour scheme and layout; plus you’ve added brackets, which is a nice bit of extra functionality. You might want to think about addressing the overflow in the display but otherwise great job!

1 Like

Hi, Yes thank you for the advice about the overflow. I was aware about that, but completely forgot. Anyway I’ll stay away from coding a couple of days, then move on to the last project remaining I have for that module (JS librairies). Happy coding :slight_smile:

1 Like

Yeah, I’m planning to start the last project next week. Probably! Happy coding!