Back to Freecodecamp

Step 15

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

latest1.6 KB
Original Source

--description--

The next step is to add another console statement that outputs the string "Here are examples of finding the positions of substrings in the sentence.".

--hints--

You should have a console statement that outputs the string "Here are examples of finding the positions of substrings in the sentence.".

js
assert.match(code, /console\.log\((['"])(Here\s+are\s+examples\s+of\s+finding\s+the\s+positions\s+of\s+substrings\s+in\s+the\s+sentence\.)\1\)/);

--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);

const strLengthIntro = `Here is an example of using the length property on the word ${subject}.`;
console.log(strLengthIntro);

const strLength = subject.length;
console.log(strLength);

console.log(`Here is an example of using the length property on the word ${topic}.`);
console.log(topic.length);

console.log(`Here is an example of accessing the first letter in the word ${subject}.`);

console.log(subject[0]);

console.log(`Here is an example of accessing the second letter in the word ${subject}.`);
console.log(subject[1]);

console.log(`Here is an example of accessing the last letter in the word ${subject}.`);

const lastCharacter = subject[subject.length - 1];
console.log(lastCharacter);

const learningIsFunSentence = "Learning is fun.";

--fcc-editable-region--

--fcc-editable-region--