snack-boomz / GUI-Calculator

Quick GUI Calculator - The Odin Project Web Development Online Curriculum: Foundations Course: GUI Calculator
https://snack-boomz.github.io/GUI-Calculator/
1 stars 0 forks source link

Remove magic number #7

Open oparkins opened 3 years ago

oparkins commented 3 years ago

22 in

https://github.com/snack-boomz/TheOdinProject-JavaScript-GUICalculator-2/blob/cb79ac3f8a53f6944a4e06fd84d4864628eb9ea3/script.js#L355

is a magic number. Not sure where it is coming from or why. It is possible I missed the reasoning earlier. But it would be good to remove this magic number and replace with a constant. Then the constant could have the description for why 22.

Some references:

snack-boomz commented 3 years ago

Screen Shot 2021-07-17 at 8 40 22 AM

So if you look here, line 355 prevents the calculator display from overflowing; without this line I put in there, the calculator would allow me to keep clicking buttons and thus, overflow the display. That being said, I definitely should replace number 22 with a const variable that clarifies the purpose.

Thanks!