

Add a link to your finished project below!.If you think you need to see a video solution first, be sure to pick up Bluelime's 27 JavaScript Projects Beginner Course.Implement the JavaScript code in your own app.js file.Delete the contents of the app.js file.Download the source code from the github repository above.This project took me about two hours to code the JavaScript functionality completely on my own, having never looked at the instructor's code. I easily determined which variables were accessible to which functions instead of beating myself up, like I would do in the past, when I couldn't find out what was going on. Learning more about JavaScript's execution context also helped me code this project relatively quickly. I remembered that if I wanted to check fo NaN, I needed to use the isNaN() built in function. So, my code would have never gotten through.

Then I remembered (from my most recent studies from Tony Alicea's JavaScript Course) that NaN = NaN evaluates to false. I was tried to check if the condition were true, which I know it was. The first debugging tactic I used was checking up on why code was not getting through when using the line if (NaN = NaN). New Things Learned or RefreshedĬoding as many projects as I have (and learning to debug them) has certainly helped with memory recall. Both games still give the user 10 changes to guess the number.

I changed my game to use values from 1 to 100. Last, the instructor created a game with values from 1 to 500. With this change, the user could simply key in a guess and press the ENTER key or click the submit button. I changed the project so that the input box was wrapped in an HTML form. This meant that the user had to actually click a button with mouse each time a guess was submitted. Second, the instructor used a element to wrap the input box, and simply gave the div a class of “form”. I changed this to make the game look much more pleasant to me. For whatever reason, the instructor styled most of the HTML elements with a left margins and left paddings, which made the elements off-center. The game that I have hosted on github is slightly different than what the instructor created.įirst, I change a lot of the CSS styling. This JavaScript number guessing game project was fun to build. This JavaScript number guessing game project's objective is to code a game where the user must guess a randomly generated number from 1 to 100. JavaScript Number Guessing Game Project (Hosted on Github Pages) Source Files Share JavaScript Number Guessing Game Project Hosted Project
