Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update game.js #507

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update game.js #507

wants to merge 1 commit into from

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