Giselle-97/Dados-y-Apuestas

Some improvements

Opened this issue · 0 comments

Really cool job @Giselle-97 !!!

Here you have some tips to improve the exercise:

JavaScript: basic

JavaScript: advanced

  • You are writing many times "trackEl.innerHTML = 'something';", what about making a function that accepts a string as param and paints it into 'trackEl'?
  • It's better to use a global variable to store the balance amount of the player, sum or subtract the bet and refresh the HTML using that variable.

Good practices

  • Indent and avoid extra white spaces to improve readability and prevent bugs. Configurate code formatter in VS Code!!!
  • Make multiple commits as you work.
  • Try to improve your commits messages. "Add JS" is a bit poor. "Add random number logic" is more explanatory.

HTML

  • Add form
  • Don't leave attributes with empty value.

Further challenges

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

  • Check if the player has enough money to bet and if the bet is greater than 0 and lower than the current amount of the player.
  • Add a reset button that cleans the select, balance of money and writes the initial feedback.
  • Show the restart game button when the game is over and hide the play button.
  • Complete the code needed for the restart game button.
  • Validates if the balance of money is available is less than the money bet and displays a message
  • 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