From 9c781da63bc744281132b44cf82f671ca5645a0e Mon Sep 17 00:00:00 2001 From: Duong The Pham Date: Sat, 14 Dec 2024 19:48:31 +0700 Subject: [PATCH] fix(curriculum): fix Building a Dice Game - Step 14 - passing with incorrect code (#57513) Co-authored-by: Naomi --- .../657e230500602983e01fff6e.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-algorithmic-thinking-by-building-a-dice-game/657e230500602983e01fff6e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-algorithmic-thinking-by-building-a-dice-game/657e230500602983e01fff6e.md index 3f3760e5810..fe6634e6d5b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-algorithmic-thinking-by-building-a-dice-game/657e230500602983e01fff6e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-algorithmic-thinking-by-building-a-dice-game/657e230500602983e01fff6e.md @@ -56,13 +56,18 @@ assert.strictEqual(scoreSpans[3].innerText, ", score = 30"); If no straight is rolled, your `checkForStraights` function should enable the final radio button, set the value to `0`, and update the displayed text to `, score = 0`. ```js -resetRadioOptions(); -checkForStraights([1,1,1,1,1]); -assert.isTrue(scoreInputs[3].disabled); -assert.isTrue(scoreInputs[4].disabled); -assert.isFalse(scoreInputs[5].disabled); -assert.strictEqual(scoreInputs[5].value, "0"); -assert.strictEqual(scoreSpans[5].innerText, ", score = 0"); +const assertNoStraight = (_diceValuesArr) => { + resetRadioOptions(); + checkForStraights(_diceValuesArr); + assert.isTrue(scoreInputs[3].disabled); + assert.isTrue(scoreInputs[4].disabled); + assert.isFalse(scoreInputs[5].disabled); + assert.strictEqual(scoreInputs[5].value, "0"); + assert.strictEqual(scoreSpans[5].innerText, ", score = 0"); +} + +assertNoStraight([1,1,1,1,1]); +assertNoStraight([1,1,4,4,4]); ``` You should call the `checkForStraights` function when the `rollDiceBtn` is clicked.