Back to Freecodecamp

Step 5

curriculum/challenges/english/blocks/workshop-teacher-chatbot/66b59be6ab830800c4df9146.md

latest1.6 KB
Original Source

--description--

Now, it's time to use the variables you created in the previous step.

In previous lessons, you learned how to work with template literals like this:

js
const name = "John";
const age = 30;

// My name is John and I am 30 years old.
`My name is ${name} and I am ${age} years old.`;

Start by creating a sentence variable.

Using template literal syntax, assign the string Today, you will learn about [topic variable goes here] in [subject variable goes here]. to the sentence variable.

You will replace the [topic variable goes here] and [subject variable goes here] placeholders with the topic and subject variables and ${} syntax.

Finally, log the sentence variable to the console.

--hints--

You should have a sentence variable.

js
assert.isNotNull(sentence);

Your sentence variable should be a string.

js
assert.isString(sentence);

You should use template literal syntax to assign the string Today, you will learn about [topic variable goes here] in [subject variable goes here]. to the sentence variable. Refer to the example if you need help.

js
assert.match(code, /Today,\s*you\s+will\s+learn\s+about\s+\$\{topic\}\s+in\s+\$\{subject\}\./);

You should log the sentence variable to the console.

js
assert.match(code,/console\.log\(\s*sentence\s*\);?/);

--seed--

--seed-contents--

js
console.log("Hi there!");

const botName = "teacherBot";

const greeting = `My name is ${botName}.`;
console.log(greeting);

const subject = "JavaScript";
const topic = "strings";

--fcc-editable-region--

--fcc-editable-region--