Calculator-app with Typescript React, Scss.

Solution retrospective
In this project, my main objective was to make the code more accessible and conform to semantic standards. I initially considered using the "eval" function, but realized that it could be dangerous and is generally not recommended. As a result, I had to come up with a new approach for implementing the calculator's functionality, which I found quite enjoyable. Additionally, I was able to apply my recently acquired skills in regular expressions to the project.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @ChamuMutezva
Hi. So far so good with your application. Here are some considerations to look at:
- Set a maximum number that can be entered in the display. I can currently enter any number by continually pressing a button.
- Do the following calculation
0.1 + 0.2
- I can write such as
90....768.8
, what I mean here is create a condition that does not allow to enter more than 1 decimal point. - This can also be avoided
9+-/*123
- Do a calculation that gives you infinity eg
100/0
, then press the delete button to remove some characters from infinity and perform a calculation. How best can those scenario be handled
Happy coding
Marked as helpful - @RubenSmn
Hi Frank, just played around with your calculator.
When calculating something like
5+6
which result in11
after that I wanted to immediately calculate4*2
but instead of that the input did no clear and I got114*2
, not sure if this was something intended but I would like to mention it.From that great work!
Marked as helpful - @abdullah43577
Hello Frank,
Great job taking on this challenge, using the eval() method isn't entirely bad, you can make your use of eval() safe by using strict mode, this means that you can add a piece of code at the top of every js file you would be using eval() for
use strict
this avoids some of the most dangerous use of eval().The
eval()
function evaluates JavaScript code represented as a string and returns its completion value. The source is parsed as a script.But it's great seeing that you got the challenge completed already without using eval(). That's very nice. I used eval() in my project and it saved me tons of lines of code.
Marked as helpful
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