Skip to content

Commit d9dae49

Browse files
authored
Merge pull request #2 from totalo-dev/jules-11689835566467508069-ef725c22
fix(review-mode): require exact or full word match for commands
2 parents 2dff50d + a91ddff commit d9dae49

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

assets/js/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,9 +917,9 @@ reviewInput.addEventListener('keydown', (e) => {
917917
function checkAnswer() {
918918
const userAnswer = reviewInput.value.trim().toLowerCase();
919919
const currentCmd = shuffledCommands[currentQuestionIndex];
920-
const expectedCmd = currentCmd.cmd.toLowerCase();
920+
const expectedCmd = currentCmd.cmd.replace(/&lt.*/, '').toLowerCase().trim();
921921

922-
if (userAnswer.startsWith(expectedCmd) || expectedCmd.startsWith(userAnswer)) {
922+
if (userAnswer === expectedCmd || userAnswer.startsWith(expectedCmd + ' ')) {
923923
score += 10;
924924
updateScore();
925925
reviewFeedback.className = 'feedback success';

0 commit comments

Comments
 (0)