Word games
Hard
·
90 minutes
Prompt
Wordle is an amazing word game and you should play it right now!
The premise is simple: every day there's a new five-letter secret word, and the user has to guess it. They have six tries, and with every try they get some feedback on each letter of the submitted word:
- If the letter is present in the word, it will be highlighted yellow
- If the letter is present in the word AND in the correct position, it will be highlighted green
- If the letter is not present in the word, it will be greyed out
The user wins if they correctly guess the word within six tries.
You'll be implementing a basic version of the original Wordle game, with the following requirements:
- User can enter guesses via the input
- User can submit a guess by pressing ENTER while focused on the input
- User receives feedback on a guess in the form of highlighted letters (see description above)
- User should see how many guesses they have remaining
- If the user correctly guesses within six tries, user should receive a success message: "You correctly guessed the word in N tries!"
- If the user does not correctly guess within six tries, user should be informed what the word was: "The word was '______'"
- Repeat letters in both the word and guess should be handled correctly
- Submissions with repeat letters should provide valid feedback (e.g. daily word='baring', submitted word='abbey', the 'a' and the first 'b' should be highlighted yellow)
API endpoints
Get the word of the day
- Method:
GET
- URL: https://api.frontendeval.com/fake/word
- Example response:
north
Check if a word is in the 5-letter word dicrionary
- Method:
POST
- URL: https://api.frontendeval.com/fake/word/valid
- Example request:
{ word: 'alien' }
- Example response:
true
Submitting solutions
- Create a solution by forking one of our CodePen templates:
- Submit your solution here