Build Wordle: guess a 5-letter word in six tries, with per-letter color feedback after each guess — green for the right letter in the right spot, yellow for a letter that's in the word but misplaced, grey for absent. The subtle part is the coloring algorithm: it must handle duplicate letters correctly, which takes two passes.
type Score = 'correct' | 'present' | 'absent';
function scoreGuess(guess: string, answer: string): Score[];
// A self-contained component. No props.
function App(): JSX.Element;
answer = REACT, guess = TRACE →
T present · R present · A correct · C present · E present
answer = REACT, guess = EERIE →
only ONE E is colored (answer has one E); the extra E's are absent
Unlock the solution & editor
Runnable editor + tests
Solve in the browser with instant Jest feedback.
Detailed solutions
Walkthroughs, edge cases, and complexity notes.
Multi-framework variants
React, Vue, Vanilla, Angular — same question, different stacks.