We’re at the end of our project. Since we standardized our variables so that the code could check them all the same way, our code is all set to go. I just needed to put in the switches for subtraction and multiplication. They will just get set equal to 1 when they are clicked.
Then I just looked at a couple things I wanted to take care of. Play your game. Stop and change what you notice is off.
The way the game is set up, you could just keep clicking on math options and clicking add, subtract, and multiply. They could all be turned on at once. Instead of worrying about turning switches off once they were used, I decided to just take away the ability to click on Math Options once they are used. I just used display:none to get rid of them once a choice was made.
I also changed when the box to write in the answer shows up. It’s not needed until there is a math problem to solve, so it doesn’t show up now on “Draw.”
A final thing I took care of was to empty out the input box, so the user wouldn’t have to delete their old answer to write in their new one. To do that we give it a value of nothing with empty quotes.
This applies the value of emptiness to any input blank. This is using JQuery. That’s what the $ is for. The JQuery library has things available for us like “val” or “empty” or “append”, etc.
In the next lesson we’ll look at the mobile display and we’ll be done.
You can watch this lesson.