Review Algorithmic Thinking by Building a Dice Game - Step 4

Tell us what’s happening:

Hi there! I have this issue with my code. The instructions told me to show an alert if the dice have been rolled 3 times. I did just that with my code, but still doesn’t let me pass. Is there something wrong with my code?

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

rollDiceBtn.addEventListener("click", () => {
  rollDice();
  rollLogic();
});

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 4

Btw here’s the function code :

function rollLogic () { if (rolls === 3) { alert("Please select a score"); return; } else { rolls += 1; currentRoundRolls.textContent = rolls; } }

Hi @raihanazhar05

For this step you do not need to create a function.
Just add the logic into the .addEventListener callback function.

Happy coding