Learn Form Validation by Building a Calorie Counter - Step 61

I cant do it this exercise, any help will be welcome.

function getCaloriesFromInputs(list) {
  let calories = 0;

  for (const item of list) {
    const currVal = cleanInputString(item.value);
    const invalidInputMatch = isInvalidInput(currVal);

    if (invalidInputMatch) {
      alert("Invalid Input: ")
    }
  }
}

Error:
You should use a template literal to pass the "Invalid Input: " message to the alert() function.

Link to exercise:
Learn Form Validation by Building a Calorie Counter - Step 61

Hi @dylanmazurzgainer

Using a template literal, in your if block, call the alert() function to tell the user "Invalid Input: " , followed by the first value in the invalidInputMatch array.

There are two more parts to this step.

  1. use template literal
  2. followed by the first value in the invalidInputMatch array

Happy coding

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.