What is the answer to the number guesser?

Where do you find the code that tells you the answer is 3?

If you click the folder icon in the code editor, you can see the other files that are being used in this exercise. There are 4 files in there, with index.html being the one we edit for the lesson. Of the others:

  • style.css changes the look to the website.
  • check.html contains code to run the next script to check your number and displays the results (notice the go back button to return to the main page)
  • Finally, numCheck.js is a javascript that has the number set in and compares it to the number you enter.

If you aren’t familiar with javascript yet, don’t worry. It’ll come later. It is used to create interactivity in websites.

30 Likes

there is a JavaScript in files their you can see number is 3

So, you click the file icon, and then you choose the file that the title is have “numCheck.js”, and then you click the “numCheck.js” text. and the code editor of JavaScript is appear in your screen. so if you see there’s the code if(num==3){ check.innerHTML = 'You guessed correctly!'; } and else{ check.innerHTML = 'Try again...'; }

the else{ check.innerHTML = 'Try again...'; } is the code when the guesser enter the wrong number, the text displays “Try again” in your screen. But the if(num==3){ check.innerHTML = 'You guessed correctly'; } code is when the guesser enter the number 3, the text displays, “You guessed correctly”. like that. so, the answer is number 3.
Thank you

by: sebasjad5
to: jordan.j314

^-^-^-^-^-^-^-^-^-^-^-^-^-

3 is the correct answer