Learn Form Validation by Building a Calorie Counter - Step 41

Tell us what’s happening:

This question really comes from a conversation with one of the coding moderators, with me, trying to further understand what concatenate is meant to be…

Your code so far

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

/* file: styles.css */

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

function addEntry() {
  const targetId = '#' + entryDropdown.value;
  targetInputContainer = document.querySelector() + targetId + '.input-container';

}

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

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 41

@ILM but this would be concatenated?

you are concatenating stuff, yes, but:

  • document.querySelector() needs an argument
  • document.querySelector() doesn’t return a string, so it doesn’t make sense concatenating it with a string
  • you where not asked to do that, try reading more carefully

so how do you pass the string to querySelector() as asked in the question?

This is not the first time you need to call a function or method, what issue are you having here?

The question asks to pass the string to querySelector() , how then do you do that?

put it between the parentheses, like every time you call a method or function with an argument

It looks like you are missing some basics, I’m afraid you are going to find things harder and harder going on without basics

That step did not ask for a call…

and assign it the value of document.querySelector()

Yes, it did. As I said, you are quite missing some basics.

1 Like