Tell us what’s happening:
why is my template literal not substituting with the value for the variable subject? it is just reposting the $ and the curly braces.
Your code so far
console.log("Hi there!");
const botName = "teacherBot";
const greeting = `My name is ${botName}.`;
console.log(greeting);
const subject = "JavaScript";
const topic = "strings";
const sentence = `Today, you will learn about ${topic} in ${subject}.`;
console.log(sentence);
// User Editable Region
const strLengthIntro = 'Here is an example of using the length property on the word ${subject}.';
console.log(strLengthIntro);
// 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/147.0.0.0 Safari/537.36 Norton/147.0.0.0
Challenge Information:
Build a Teacher Chatbot - Step 6
GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-teacher-chatbot/66b6d482bbb9e12f2e5ee1ae.md at main · freeCodeCamp/freeCodeCamp · GitHub
Hi
You use backticks for template literals not single quotes.
can I see an example of how those are used?
These are backticks:
``
You correctly used backticks on some of your code but not this line:
const strLengthIntro = 'Here is an example of using the length property on the word ${subject}.';
I found that part, but with the literals. I put that on with the $ and the curly braces, but it didn’t change anything.
On your code, can you see the difference:
const strLengthIntro = 'Here is an example of using the length property on the word ${subject}.';
and
const sentence = `Today, you will learn about ${topic} in ${subject}.`;
Can you see why the first line isn’t right? See my posts above which explains why
I got it now. Use the backwards quote thing when you are using the curly braces instead of the quotes you use for a regular string.