Build a Recipe Ingredient Converter - Step 17

Tell us what’s happening:

I reviewed some other forms and they said there is a bug. I am not sure how can I pass the test. any help?

Your code so far

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

/* file: styles.css */

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

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

const updateResultsList = () => {
  resultList.innerHTML = "";
  const name = ingredientName.value;
  const capName = name.charAt(0).toUpperCase() + name.slice(1);
  
  units.forEach((unit) => {
    if (unit !== unitToConvert.value){
      const finalQuantity = processIngredient(ingredientQuantity.value, unitToConvert.value, unit, numberOfServings.value);
     
  
      const li = document.createElement('li');
      li.textContent = `${capName}: ${parseInt(finalQuantity)} ${unit}s`;

      resultList.appendChild(li);
    }
  })
}

recipeForm.addEventListener("submit", updateResultsList);



// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36

Challenge Information:

Build a Recipe Ingredient Converter - Step 17

do not pluralize the unit of measure

the bug is related to that, the instructions say one thing but a different thing is tested

I removed “s” from unit.

li.textContent = `${capName}: ${parseInt(finalQuantity)} ${unit}`;

still not passed, any hint about the bug?

you also should not round to an integer

if you are converting 5 grams of flour, you should have 0.10 cups and 0.88 ounces

1 Like