Tell us what’s happening:
I don’t understand why both the conversion to Int and the sum aren’t considered correct to pass the test.
Errors in console:
2. Your updateScore function should convert string value to integer and add the value to the total score.
3. Your updateScore function should add the value of the first parameter to the total score.
‘’’
const updateScore = (value, id) => {
const valueNum = parseInt(value || 0);
let currentScore = parseInt(totalScoreElement.value || 0);
currentScore += valueNum;
totalScoreElement.textContent = currentScore;
scoreHistory.innerHTML += <li>${id} : ${value}</li>
;
}
‘’’
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const updateScore = (value, id) => {
const valueNum = parseInt(value || 0);
let currentScore = parseInt(totalScoreElement.value || 0);
currentScore += valueNum;
totalScoreElement.textContent = currentScore;
scoreHistory.innerHTML += `<li>${id} : ${value}</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/109.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 9