Tell us what’s happening:
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: ${invalidInputMatch[0]}');
}
}
}
This is what I have tried I’ve tried everything I can think of the get this to work but I can’t figure out what is going wrong. Even Copilot isn’t finding anything wrong with it please help!!!
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
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: ${invalidInputMatch[0]}');
}
}
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 64