[x] If we repeat several times parseInt(value) within a function it is better set it in a constant.
[x] Remove debugger and other unnecessary code.
[x] Add semicolons to the end of all statements.
JavaScript: advanced
[x] Check if the <input> has an empty value or text.
[ ] 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'?
Good job @Virlucero !!!
Here you have some tips to improve the exercise:
JavaScript: basic
'use strict'
at the beginning of the js document..innerHTML
or.value
to get DOM content we receive a string. Sometimes we will need to use something likeparseInt()
to convert it to a number: https://github.com/Adalab/modulo-2-evaluacion-intermedia-Virlucero/blob/07d5b4a881e4caab188fc71acb9b99ce1d15e9d2/main.js#L34parseInt(value)
within a function it is better set it in a constant.JavaScript: advanced
<input>
has an empty value or text."trackEl.innerHTML = 'something';"
, what about making a function that accepts a string as param and paints it into'trackEl'
?JavaScript: good practices
Good practices
Structure
HTML
div
,p
) and number of trials.for
attribute of the label and theid
of the input.CSS
Further challenges
Then you can improve the game as you please, here you have some ideas:
Call to action
Let me know if you have any doubts ;)
Go for it!!