I tried a lot of things for this one: // running tests
When clicking the button your updateResultsList function should properly update the DOM.
// tests completed . But it seems there’s something I’m missing. The tests looks good on the converter, same result and format as expected, but I just can’t find my mistake. I tried to use appendchild, capitalize the first letter, adding
marks at he begining and end, etc. I’m really stuck
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const updateResultsList = () => {
resultList.innerHTML = "";
// resultList.innerHTML = `<ul id="result-list">`;
units.forEach((unit) => {
if (unit != unitToConvert.value) {
const qu = convertQuantity(unitToConvert.value)(unit)(ingredientQuantity.value).toFixed(2);
// const cap = (str) => str.charAt(0).toUpperCase() + str.slice(1);
resultList.innerHTML +=`<li>${ingredientName.value}: ${qu} ${unit}</li>`;
}
// resultList.innerHTML += `</ul>`;
})
}
// 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/142.0.0.0 Safari/537.36
As I show you before, yes, the format matches the example. At least at what I can see. spaces, quantity format, etc.
The error states
When clicking the button your updateResultsList function should properly update the DOM"
So I guess maybe is the way I update de DOM, so I tried const updateResultsList = () => {
resultList.innerHTML = “”;
units.forEach((unit) => {
if (unit != unitToConvert.value) {
const qu = convertQuantity(unitToConvert.value)(unit)(ingredientQuantity.value);
const newLi= document.createElement(“li”);
newLi.textContent =${ingredientName.value}: ${qu.toFixed(2)} ${unit};
resultList.appendChild(newLi)
}
})
}
Where does it say such a thing? I don’t see anything that says I should decapitalize the first letter. I’d assume the output should match whatever is given as input. Besides, I don’t think the format is the issue here. As for the backslashes, I have no idea where they came from, probably from copying and pasting here. They’re not in any version of my code .
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.
The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.