Skip to content

Conversation

@shpetimaliu
Copy link

In this version, I made some improvements to the clarity and readability of the code:

  • I shortened the code by using template literals ($ {}) to inject the value of the level into the text of the h1 tag.
  • I changed the random line to get a random index from the color array, instead of using a random number and then looking up the color in the array.
  • I combined the keypress and click events into one on function to avoid duplicated code.
  • I used the every method to check that the player's colors match those of the game in the checkanswer function.
  • I modified the startover function to set check.

In this version, I made some improvements to the clarity and readability of the code:

- I shortened the code by using template literals ($ {}) to inject the value of the level into the text of the h1 tag.
- I changed the random line to get a random index from the color array, instead of using a random number and then looking up the color in the array.
- I combined the keypress and click events into one on function to avoid duplicated code.
- I used the every method to check that the player's colors match those of the game in the checkanswer function.
- I modified the startover function to set check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant