Some improvements
Closed this issue · 0 comments
ytaylordev commented
Really cool job @noemiyuen !!!
Here you have some tips to improve the exercise:
JavaScript: basic
- Think of a more efficient way to compare the results of each race: https://github.com/Adalab/modulo-2-evaluacion-intermedia-NOEMIYUEN/blob/806627b0c9d6ee627c34b7a662c450a8ee73c9bb/js/main.js#L35-L71
- Fix the if's structure: check for one option, then the other and then for the rest is enough with an
else
statement. - Remove debugger and other unnecessary code: https://github.com/Adalab/modulo-2-evaluacion-intermedia-NOEMIYUEN/blob/806627b0c9d6ee627c34b7a662c450a8ee73c9bb/js/main.js#L28
Bonus
- Add a reset button that cleans the select, the counter and writes the initial feedback
JavaScript: advanced
- Check if the
<select>
has the default option (with no value). - You are writing many times
"trackEl.innerHTML = 'something';"
, what about making a function that accepts a string as param and paints it into'trackEl'
?
JavaScript: good practices
- Declare your global variables at the beginning of the JavaScript file (after querySelector section): https://github.com/Adalab/modulo-2-evaluacion-intermedia-NOEMIYUEN/blob/806627b0c9d6ee627c34b7a662c450a8ee73c9bb/js/main.js#L94-L97
Good practices
- Usually, function names start with a letter in lowercase.
- Try to use imperative for functions names.
- Try to improve your commits messages. "Add JS" is a bit poor. "Add random number logic" is more explanatory.
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.
- 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