Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Javascript Calculator App

Ric 210

@Ripra87

Desktop design screenshot for the Calculator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


This was an hard challenge, there is still some bugs but it works good and without problems. If you can check my code, especially the JS, i would be really happy to receive some advice! it was my first intermediate level challenge, and i'm surely made many mistakes, i look forward to receive every suggestion! Happy coding!

Community feedback

@deep0133

Posted

Problem:

  1. Result Area Overflow if number Length>16
  2. when I enter (12/0.1 ) it give correct output (120) but after it if I press del key for clear screen and repeat the calculation then it concatenate the new output with previous output. eg - after clear the screen by del key : 12/0.1 => output: 120120. Solution:
  3. style : overflow: auto;
  4. use [eval] method for calculating the result. eg - eval("input_string")
1

Ric 210

@Ripra87

Posted

@deep0133 Hi and thanks for your comment!

about the point 4, i use eval(), is in the resultFunction, i firstly connect all the elements in one string with join() and than convert the string with eval(), maybe i didn't understand what do you mean.. :P

for point 2, yes i noticed it, maybe you can help me )) The problem is into the sequence of the code: when you type a number, this number firstly go into an empty array (typedNumber) and after press an operation button (+ - * /) the complet number has been pushed inside the array. The function cancel(), called by pressing DEL, remove the last typed number, so the last character, with slice() from the string, but here is the problem, inside the array i have the "complete number" and with slice i remove the complete number, not only the last character (example, typing 10 and pressing del i remove the 0, but when you ask for the result the element in the array is "10", so if i slice() it i don't remove only the 0, but the total number 10) so the del button works only before the number is pushed into the array. I hope what i said is clear and the problem is understandable, i'm still working on how to fix it ))

0

@deep0133

Posted

Okay, it is my fault for not noticing the eval method in the code. You can forget the fourth point.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord