AranchaAdalab / f-m2-evaluacion-intermedia-AranchaAdalab

¿Cuántos intentos te costará encontrar el número secreto? ¡Juega y mejora tu marca!
http://beta.adalab.es/f-m2-evaluacion-intermedia-AranchaAdalab/
MIT License
0 stars 0 forks source link

Finish the exercise! #1

Closed oneeyedman closed 5 years ago

oneeyedman commented 5 years ago

Hi, @AranchaAdalab !!!

You are close to the exercise solution, but here you have a steps guide to complete it anyway ;)

  1. Save a reference to DOM elements in variables
  2. Generate the random number and save it to a variable
  3. Init counter of trials to 0
  4. Define a function that executes when the user clicks on the button, that
    • increments the counter and paints its value in the HTML
    • collect the value of the HTML input and compare it with the random number
    • if they are equal, draw a 'You Win' message
    • if it's lower, draw a 'Too short' message
    • if it's higher, draw a 'Too long' message
  5. Assign a listener to the button click to execute the previous function

Then you can improve the game as you please, here you have some ideas:

Let me know if you have any doubts ;)

Go for it!!

AranchaAdalab commented 5 years ago

Hi @oneeyedman

I tried to improve the game, but there are some things that I don't know how to do it (I tried them but I didn't get it):

I would appreciate if you can give me some clues.

Thank you!

oneeyedman commented 5 years ago

Oki, I'll try my best!!

Once you win the game, it would be great that a reset button appears so that the user can play again. This button should call a function that sets the counter back to zero and chooses another random number.

What do you think? Better? worse?

You got this!

Yoy got this

AranchaAdalab commented 5 years ago

Hi @oneeyedman

I finished my exercise!

oneeyedman commented 5 years ago

YAY!! Well done @AranchaAdalab!

If you are up to a challenge check out these exercises from previous Adalabers:

;)