COLOR GUESSING GAME
Hello to all.. I have been trying to improve my skllls on JS with all that I have learned so far in this awesome website!.. I found this pretty interesting excercise on the internet.. but I don`t know how to make it work properly!
The game is essentially the user has to guess a color that is inside an array of colors that is set randomly, if the user gets wrong he will have another opportinity until he gets right!.. at the end the code will show the user how many guesses he did!.. the problem that I have is the next one:
- The code has to show the user three things: 1 - if the user do not enter a color that is in the array it will show a message "That is not a color in the range!" 2 - if the color that the user introduces is either lower or higher alphabetically it will show a message with hints to the user to guess properly.
with the lower and higher color I have not problem.. but I cannot get that error message properly that shows ("That is not a color range!") .. I don't get what is wrong with my code, I always get "that color is not in the range!" even though I put a color name that IS in the array, so I finish in a infinite loop!.. how can I do to get that message correctly when I run the game?.. you can check the code below!..