Confused on the solution to step 40 of javascript calorie counter

The wording of the question has me confused. It’s asking " be sure to keep the space between your targetId variable and .input-container."

so before we were using ’ .input-container’ to maintain the space.

when using template variables does the space maintain itself inside the `` without having to ’ .input-container’ to maintain the space? basically \ `$[variable} .input-container; maintains the spacing that we did before with the single quotes in the concatenation on the previous step? I spent a ton of time trying to keep the preious spacing for the code, but maybe I wasnt understanding that they were just asking to keep a space between the 2 pieces of code. I dont know. I’m just looking to clarify this. I did figure it out after searching a bit

It looks like you might be referring to step 39 here

Short yes.
When you are working with template literals, then you can just add a space between words without having to do stuff like this

const activity = "learn"
"I like to " + activity

Now maintaing the space is much easier to see when rewritten using template literals

const activity = "learn"
`I like to ${activity}`

That is one of the reasons why people prefer using template literals over the old school way of string concatenation is because with the older way it is so easy to get tripped on spacing issues. Template literals make it easier and more intuitive to know where the spaces should go

thanks for clarifying. I was banging my head for a bit on it.

Seems a challenging task.

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