mariasola / m2-evaluacion-intermedia-Mariasola

Mariasola
http://beta.adalab.es/m2-evaluacion-intermedia-Mariasola/
0 stars 0 forks source link

Improvements #1

Closed migueldelmazo closed 5 years ago

migueldelmazo commented 5 years ago

Really cool job @Mariasola !!!

Here you have some tips to improve the exercise:

https://github.com/Adalab/m2-evaluacion-intermedia-Mariasola/blob/master/main.js#L31 >>> WooooW!!!! ;)

JavaScript

JavaScript - Good practices

Good practices

Structure

HTML

Steps to finish the game (for those far from the solution)

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

Further challenges

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!!

migueldelmazo commented 5 years ago

Si me conviertes este array en un objeto te prometo que expongo tú código en el louvre!!!!

mariasola commented 5 years ago

Listo!