Back to Freecodecamp

Step 6

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

latest1.5 KB
Original Source

--description--

For this next portion of the project, the bot will teach working with the string length property.

Start by creating a new variable called strLengthIntro.

Then using template literal syntax, assign the string Here is an example of using the length property on the word [subject]. to the strLengthIntro variable.

Replace [subject] with the subject variable like you did earlier.

Finally, log the strLengthIntro variable to the console.

--hints--

You should have a variable called strLengthIntro.

js
assert.isNotNull(strLengthIntro);

Your strLengthIntro variable should be a string.

js
assert.isString(strLengthIntro);

You should use template literal syntax to assign the string Here is an example of using the length property on the word [subject goes here]. to the strLengthIntro variable.

js
assert.match(code,/`Here\s+is\s+an\s+example\s+of\s+using\s+the\s+length\s+property\s+on\s+the\s+word\s+\$\{subject\}\.`/);

You should log the strLengthIntro variable to the console.

js
assert.match(code,/console\.log\(\s*strLengthIntro\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";

const sentence = `Today, you will learn about ${topic} in ${subject}.`;
console.log(sentence);

--fcc-editable-region--

--fcc-editable-region--