Back to Freecodecamp

Step 14

curriculum/challenges/english/blocks/workshop-greeting-bot/66adcf383276814776aba3ca.md

latest1.9 KB
Original Source

--description--

Next, create a variable called favoriteSubjectSentence.

Use string concatenation to join the string "My favorite subject is " with the favoriteSubject variable followed by a period.

Assign the result to the favoriteSubjectSentence variable.

Then, log the value of favoriteSubjectSentence to the console.

--hints--

You should have a variable called favoriteSubjectSentence.

js
assert.isNotNull(favoriteSubjectSentence);

Your favoriteSubjectSentence variable should be a string.

js
assert.isString(favoriteSubjectSentence);

You should use string concatenation to join the string "My favorite subject is " with the favoriteSubject variable followed by a period. Be mindful of the spaces.

js
assert.strictEqual(favoriteSubjectSentence, "My favorite subject is Computer Science.");

You should have a console statement in your code.

js
assert.lengthOf(__helpers.removeJSComments(code).match(/console\.log(.*)/g), 8);

You should log the value of favoriteSubjectSentence to the console.

js
assert.match(__helpers.removeJSComments(code), /console\.log\s*\(\s*favoriteSubjectSentence\s*\)/);

--seed--

--seed-contents--

js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
bot = "teacherBot";

let botLocation = "the universe";

console.log("Allow me to introduce myself.");

const botIntroduction = "My name is " + bot + ".";
console.log(botIntroduction);

const botLocationSentence = "I live in " + botLocation + ".";
console.log(botLocationSentence);

bot = "professorBot";

const nicknameIntroduction = "My nickname is " + bot + ".";
console.log(nicknameIntroduction);

bot = "awesomeTeacherBot";

const newNicknameGreeting = "I love my nickname but I wish people would call me " + bot + ".";
console.log(newNicknameGreeting);

const favoriteSubject = "Computer Science";

--fcc-editable-region--

--fcc-editable-region--