Build a Recipe Ingredient Converter - Step 17

I’m confused

I need help figuring out how to append a list item to resultList.
I don’t think I have the correct syntax for a lot of this. It is harder because the tests are not helpful. There is only one and so I don’t know which one I am doing wrong.

My code so far

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

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

const updateResultsList = () => {
  resultList.innerHTML = "";

  if(units !== unitToConvert.value){
    baseUnit = newUnit;
    resultList = `<nl>${ingredient}: ${quanitity} ${unit}</nl>`
  }
}

// User Editable Region
/* file: styles.css */

My browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Challenge Information:

Build a Recipe Ingredient Converter - Step 17

remember that resultList is an html element

you access it here first to reset its content

you can do something similar to this to add new content to the element

also be aware that nl is not a list item, I do not know of an html element with this name

Is this better?

  resultList.innerHTML = "";

  if(units !== unitToConvert.value){
    baseUnit = newUnit;
    resultList.innerHTML = `${ingredient}: ${quanitity} ${unit}`
  }
}

it’s overwriting the whole innerHTML every time, there is a way to add/append to the existing value instead. Do you remember compound assignment?

Is it using + to add variables to text? Like this:

console.log("Hello, " + name + "!")

that is concatenation, but it’s not an assignment

assignment, =, assign the value, overwrites the old value

compound assignment append the value to the right of the operator to the old value and assign the new value, instead of overwriting it

you should have met it various times so far

Oh, yes, I remember. So, how do I make the line that is += to resultList.innerHTML?