Build a Recipe Ingredient Converter - Step 18

Tell us what’s happening:

I have the expected output in the project, but I keep getting the same error message: When clicking the button your function should properly update the DOM. Please help me to understand what I’m doing wrong

Your code so far

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

/* file: styles.css */

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

const updateResultsList = () => {
  resultList.innerHTML = "";
  for (let i = 0; i < units.length; i++) {
    let unit = units[i];
    if (unit !== unitToConvert.value) {
      let convertedQuantity = convertQuantity(unitToConvert.value)(unit)(Number(ingredientQuantity.value));
      let li = document.createElement("li");
      li.textContent = `${ingredientName.value}: ${convertedQuantity.toFixed(2)} ${unit}`;
      resultList.appendChild(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/143.0.0.0 Safari/537.36 Edg/143.0.0.0

Challenge Information:

Build a Recipe Ingredient Converter - Step 18

Is there another function you could use here that would be a better fit?

1 Like

Thanks for replying to my question, I have tried every function that I can think of but to no avail

what other functions do you have available in your code?

1 Like

I have tried conversionTable, convertQuantity, adjustForServings, processIngredient , and convertedQuantity. Which one am I missing?

and can you explain why you excluded each of them?

I just tried them without sharing them after they did not pass the test, but I tried processIngredient one more time and it worked, thanks again

this is an object but not a function !

1 Like