Build a Greeting Bot - Step 7

Tell us what’s happening:
After step six

When i trying to creat a code with instruction given in step 7 it shows syntax error in line 9.

I have try to clear all previous code but same syntax error on previous lines like 8,7, 6, etc.

There is a syntax error on line 9. Please check for missing brackets, quotes, or other syntax issues.

Your code so far

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

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

Your mobile information:

SM-A566E - Android 16 - Android SDK 36

Challenge: Build a Greeting Bot - Step 7

Link to the challenge:

Welcome to the forum @Anikitos88!

Let’s look at that sytax error:

SyntaxError: unknown: Identifier 'bot' has already been declared. (10:4)

   8 | console.log("Allow me to introduce myself.");
   9 |
> 10 | let bot = "bot";
     |     ^
  11 | let botIntroduction = "My name is " + bot + ".";
  12 | console.log(botIntroduction);

It says bot has already been declared and you’re trying to declare it again on line 10.

When we declare a variable with let, that means we can reassign its value later in the code.

So, can you think of what you could do to fix that error?

That said, you were not asked to reassign a value to bot, so please reset this step by clicking the “Reset” button and try again. All of the code you added (except Line 10) looks good.

Happy coding!