Review Algorithmic Thinking by Building a Dice Game - Step 9

Tell us what’s happening:

The question is to make a method that takes two parameters, an int and a string. The number will increase the total, the total is shown in a span element. Then a list item is created and added to an ordered list that shows the string param and the num param. I have this working locally, I’ve tried all sorts of textContent, innerText, innerHTML, parseInt() approaches to pass this section. What am I missing?

Your code so far

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

/* file: styles.css */

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

const updateScore = (selectedValue, achieved) => {
  total += selectedValue;
  totalScore.textContent = total;
  let scoreLabel = document.createElement("li");
  scoreLabel.textContent = `${achieved} : ${selectedValue}`;
  scoreHistory.appendChild(scoreLabel);
}

// updateScore(10, "hi");

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 9

1 Like

There are two tests failing in the console:

// running tests
Your updateScore function should add the value of the first parameter to the total score.
Your updateScore function should update the text of the totalScore element.
// tests completed

1 Like

Turns out I needed to update score, not total for it to pass. I should have realized!

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.