Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

Tell us what’s happening:

I keep ending up with “undefined” at the end of my statement.

Please help me understand what it is that I am doing wrong.

Thank you for all your help! You guys are totally awesome!!

I tried to reassign the variables, assign the variables and I just wasn’t successful in the process. Hopefully, somebody can shed some light on this subject. It is extremely frustrating when I keep getting stuck in the course. My goal is to finish this by the end of the year. Plus, I already achieved my 1st c

Your code so far

let greetingMessage = "Hello! I'm your coding fun fact guide!";
console.log(greetingMessage);

let botName = "nintendoBuff";
console.log(botName);

let botLocation = "marsB";
console.log(botLocation);

let favoriteLanguage = "javaScript"
console.log(favoriteLanguage);

const botIntroduction = "My name is nintendoBuff and I live on marsB." + botIntroduction + ".";
console.log(botIntroduction);

Your browser information:

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

Challenge Information:

Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

I actually found where I was missing a semicolon, Unfortunately, that didn’t do the trick :wink:

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

```let greetingMessage = "Hello! I'm your coding fun fact guide!";
console.log(greetingMessage);

let botName = "nintendoBuff";
console.log(botName);

let botLocation = "marsB";
console.log(botLocation);

let favoriteLanguage = "javaScript";
console.log(favoriteLanguage);

let botIntroduction = "botIntroduction";
console.log("My name is " + botName + " and I live on " + botLocation + ".");

const botIntroduction = "botIntroduction";```

This text will be blurred

Thanks a bunch @JeremyLT , I appreciate that very much bro!

it does mot want you inserting bitIntroduction in the string, please read again

also you can’t because it does not exist yet, so you see undefined

Thank you very much for the advice @ILM!

I tried to remove botIntroduction and change it to just console.log or firstSentence, but that didn’t work either. I’ve tried a lot of different codes, but none seem to work.

I don’t know what it wants LOL

post your latest attempt

remember you already have botName, you need to create the sentence requested and assign it to botIntroduction

const botIntroduction = "Hello! I'm your coding fun fact guide!";
console.log(botIntroduction);

let botName = "nintendoBuff";
let botLocation = "marsB";
let favoriteLanguage = "javaScript";

const introSentence = "My name is " + botName + " and I live on " + botLocation + ".";
console.log(introSentence);

const secondSentence = "My favorite programming language is " + favoriteLanguage + ".";
console.log(secondSentence);

let codingFact = "codingFact";

codingFact = codingFact;
console.log("I learned " + favoriteLanguage + " 2 years ago and picked it up pretty fast.");

codingFact = " Learning " + favoriteLanguage + " is a fun tool!";
console.log(codingFact);

codingFact = "Node.js and " + favoriteLanguage + " are kind of confusing at first, then you learn how to write in " + favoriteLanguage + ".";
console.log(codingFact);

let closingSentence = closingSentence;
console.log("It was fun sharing these facts with you. Goodbye! - " + botName + " from " + botLocation + ".");```

I keep trying to assign codingFact to favoriteLanguage or vice versa and I end up getting other numbers wrong.

You should check the last statement. You have a variable that was used before it was defined.

Thank you so much @JAngel98 I finally figured it out earlier.

1 Like