Review Algorithmic Thinking by Building a Dice Game - Step 9

Tell us what’s happening:

I have been back and forth with this step exercise; I think all requested tasks has been implemented yet couldn’t pass the code.

Your code so far

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

/* file: styles.css */

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

function updateScore(selectedValue, achieved) {
score += parseInt(selectedValue);
totalScore.textContent = score;
scoreHistory.innerHTML += `<li>${achieved}:${selectedValue}</li>`;
};


// 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/128.0.0.0 Safari/537.36 Edg/128.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 9

The formatting of the string is off. As I recall the colon had a space to the left and right of it. Try that.

updated code:

function updateScore(selectedValue, achieved) {
score += parseInt(selectedValue);
totalScore.textContent = score;
scoreHistory.innerHTML += `<li>${achieved} : ${selectedValue}</li>`;
};

Yet. can’t pass…

double check this, what’s the variable with the element?

1 Like

Can you make it an arrow function instead?

It may be expecting the same style as all the other functions.

updated code

const updateScore = (selectedValue, achieved) => {
score += parseInt(selectedValue);
totalScore.textContent = score;
scoreHistory.innerHTML += `<li>${achieved} : ${selectedValue}</li>`;
};

yet!

As Ilenia mentioned the variable totalScore should be fixed as that is not the correct name of it.

1 Like

It absolute was the issue, it variable does have an extension of Element. thank you so much for feedback, appreciated. !

Thank you for your feedback

I would like to ask though, sometimes the excise is quiet out of the purview of understanding, what its fact means is to seek out others methods or solutions at such to have a clue?

if you think something is being asked of you that is completely new, let us know, but also definitely try to use google to help you look up answers (and of course search the forum). It is normal to need to look things up when learning.

1 Like