aliciaggz/rock-paper-scissor-game

Some improvements

Opened this issue · 0 comments

Really cool job @aliciaggz !!!

Here you have some tips to improve the exercise:

JavaScript: basic

  • Define the logic to transform the random number into the computer selection.
  • Extract the feedback painter to a function.
  • #2
  • Use three counter variables: one for user wins, other for computer wins and another for total rounds played.
  • Increment the round counter always the user clicks on "Jugar" button.
  • Use ONE addEventListener for each event. If you need to execute multiple functions at once perhaps you can call them inside your unique handler.

JavaScript: advanced

  • Check if the <select> has the default option (with no value).
  • Check if the round counter has reached the limit of rounds.
  • Move the feedback logic to a function and execute it on each click.
  • Move you counter logic into a function and execute it on each click.
  • You are writing many times "trackEl.innerHTML = 'something';", what about making a function that accepts a string as param and paints it into 'trackEl'?

Structure

  • Define a good structure of folders and files for the project.
  • CSS and JS path must to start with ./.

HTML

  • Don't leave attributes with empty value.

CSS

  • Avoid adding styles until the js code is solid as a rock.

Further challenges

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

  • Show an image with the user and computer selection
  • Make the input work when selecting the option.
  • Add a reset button that cleans the select, the counter and writes the initial feedback
  • Whatever you want!

Call to action

Let me know if you have any doubts ;)

Go for it!!

Do not close this issue until your teacher asks you to