Learn Form Validation by Building a Calorie Counter - Step 45

Tell us what’s happening:

Hi, this is what I have been trying:

  1. const HTMLString = ${""};
  2. const HTMLString = ${};
  3. const HTMLString = ${``};

Always with the same result:

“Your addEntry function should have an HTMLString variable.”

The error message does not help :o

Your code so far

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

/* file: styles.css */

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

function addEntry() {
  const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
  const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
  const HTMLString = `${""}`;

// 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/126.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 45

1 Like

Hello,
you forgot to add } at the end of the function, when you do it a new error will pop up stating that the variable HTMLString should be an empty template literal, just remove the ${""}

Thank you :slight_smile: but I still get the same message with my present try:
Message: " Your addEntry function should have an HTMLString variable."
I’ve pulled it into my code editor, counted brackets manually, Í don’t know :o

function addEntry() {
    const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
    const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
    const HTMLString = `
}

hi there!
you need to add a pair of template literals .

@hasanzaib1389 @constantcode9909
Thank you so much :smiley:

2 Likes