Tell us what’s happening:
i am updating my function but it still screems to me
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const updateStats = () => {
currentRoundRolls.textContent = rolls;
currentRound.textContent = round;
};
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
updateStats();
}
});
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 5
Double check the variable names.
the names are okey but it still not working
Post your updated code here.
const updateStats = () => {
currentRoundRolls.textContent = rolls;
currentRound.textContent = round;
};
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
updateStats();
}
});
after all the update they are noting that You should have a function called updateStats
.
ILM
January 8, 2025, 9:24am
8
check for syntax errors in the console
ILM
January 8, 2025, 9:24am
9
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
The currentRoundRolls
and currentRound
variables aren’t defined. Check for correct name. Check the hint given below the submit button. When you trying to submit code.
thes are my codes
const updateStats = () => {
currentRoundRolls.textContent = rolls;
currentRound.textContent = round;
rollsElement.textContent = ;
};
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
updateStats();
}
});
ILM
January 8, 2025, 9:32am
12
and you have a syntax error
plus currentRound
and currentRoundRolls
are undefined variables