@pjooklas
Posted
calculator class makeOperation() i would use switch, not if/else if and why your number1 and 2 are strings, not number type?
in ThemeSelector class changeTheme() method, you use forEach two times, you should make code to iterate only one tie, to add and to remove classes.
Marked as helpful
@CaioCouto
Posted
@pjooklas I liked your suggestion on the changeTheme() method. It's something I'm gonna think about on how to implement. Thank you for that! :)
About the makeOperation() method, I decided to go with if/else because I read somewhere that, in matters of performance (and general chaos), the difference is negligible until the number of scenarios are big enough (which I believe is not the case).
Also, number1 and 2 are strings because they're taken straight from the textContent attribute of the button elements. And since they can have more than 1 character (1, 10, 100...), I decided to leave them as strings, which makes it easier to just concatenate more and more digits as the number grows. This way I only have to convert them once: when calculating the result. Otherwise, a new str-float (and vice versa) conversion would be needed every time a new digit is pressed by the user.