Back to Freecodecamp

Step 3

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

latest1.2 KB
Original Source

--description--

Now it is time to create a greeting using the botName variable.

In previous lessons, you learned how to concatenate strings using template literals like this:

js
const name = "John";

// "Hello, John!"
`Hello, ${name}!`;

Start by creating a variable called greeting.

Next, using template literal syntax, assign a string that says My name is, followed by the botName variable, and ending with a period (.).

Finally, log the greeting variable to the console.

--hints--

You should have a variable called greeting.

js
assert.isNotNull(greeting);

You should assign a string to your greeting variable.

js
assert.isString(greeting);

You should use template literals to concatenate the string My name is with the botName variable followed by a period (.).

js
assert.equal(greeting, "My name is teacherBot.");

You should have a console statement that logs the greeting variable to the console.

js
assert.match(code, /console\.log\(.*greeting.*\)/);

--seed--

--seed-contents--

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

const botName = "teacherBot";

--fcc-editable-region--

--fcc-editable-region--