Design comparison
SolutionDesign
Solution retrospective
I decided to save the user input as a string and then used regex and the eval()
function to validate input and evaluate the expression so that order of operations would be utilised for the final result. I know MDN and other resources warn against using eval so if anyone has suggestions/feedback for other methods to implement the calculator I would appreciate the input.
Community feedback
Please log in to post a comment
Log in with GitHubJoin 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