Build a Greeting Bot - Step 7

Tell us what’s happening:

will not pass need more info… i do not understand.

Your code so far

console.log("Hi there!");
console.log("I am excited to talk to you.");

let bot;
let botLocation;

bot = "teacherBot";
botLocation = "the universe";


// User Editable Region

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

let botIntroduction;

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

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Challenge Information:

Build a Greeting Bot - Step 7

Hi there :waving_hand:,

Your code is almost perfect!

However, FreeCodeCamp wants you to modify it a little. Here’s what you should do:

  1. You need to assign a value to botIntroduction instead of directly printing it using console.log().
  2. After assigning the value to botIntroduction, remove the string from the console.log().
  3. Instead of the old console.log(), console the botIntroduction variable.

This should do the trick! Let me know if you need more help! :blush:

I just started this section and not understanding. modify a little… you got to give me an example or a segment to reference to. just not understanding.

No problem! Let me walk you through this with an example.

What you need to do:

  1. Assign the value to botIntroduction first.
  2. Then, log the value of botIntroduction to the console.

Here’s a simple example that shows you the steps:

let bot = "teacherBot";         // Assign bot's name
let botLocation = "the universe"; // Assign bot's location

// 1. Assign the greeting message to the variable 'botIntroduction'
let botIntroduction = "My name is " + bot + " and I live in " + botLocation + "."; 

// 2. Log the 'botIntroduction' variable to the console
console.log(botIntroduction); // This will print the message

Breakdown:

  • In the first step, you’re creating a message and assigning it to the variable botIntroduction.
  • In the second step, you’re logging the value of botIntroduction to the console, not writing the string directly in console.log().

Key things:

  • The botIntroduction variable stores the message.
  • You can then use console.log() to display that message.
1 Like

thank you… truly i was stumped… thank you…

1 Like

So this code should be right?

let botIntroduction = "My name is " + bot + “.”;

console.log(botIntroduction);

But I get this error:

Sorry, your code does not pass. Try again.

You should have a variable called botIntroduction.

can you help me further

Hi there,
Please consider creating a new post in the forum for your topic. It will help with better visibility and ensure a faster response. :blush:

1 Like