Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

Tell us what’s happening:

I’m unsure what exactly is causing the errors with step 11 and 14. Everything seems to be showing up in the console the way I entered it and I’m not sure how my code is different to what it’s asking for.

Your code so far

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

let botName;
botName = "bot";
let botLocation;
botLocation = "code street"
let favoriteLanguage;
favoriteLanguage = "Javascript";

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

let codingFact;

codingFact = "My favorite programming language is " + favoriteLanguage + "."

console.log(codingFact);


codingFact = favoriteLanguage + " was originally named Mocha." 

console.log(codingFact);

codingFact = "You can learn " + favoriteLanguage + " on Freecodecamp";

console.log(codingFact)
console.log(codingFact)

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

Your browser information:

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

Challenge Information:

Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

I have a few tips:

You should always use const to declare a variable unless it will change in which case you need to use let

Try to be more consistent with your ; use, some lines have it some don’t.

Neither of these really affect your code or tests though.

When you first declare codingFact the test seems to prefer that you declare and assign it all on one line. The way you’ve done it is technically ok, but you should declare and assign all of these in one line I think.

That said, I’m still not sure why it’s not passing the other tests.

14. You should assign a value to codingFact for the third time that also contains favoriteLanguage, and log it to the console.
15. You should log to the console "It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation)." using concatenation to add the values of the variables.

I suspect a bug because originally you were passing test 15 but when I implemented by suggestions above it fails 14 and 15.

aha…

  1. You should log to the console "My favorite programming language is (favoriteLanguage)." using concatenation to add the variable to the string.

This is the problem. (and the fact that you only assign 2 facts to codingFacts after this.)

Thanks, I’ve rewritten the code but it’s now showing step 11 ( 11. You should give codingFact a value that includes favoriteLanguage using concatenation.)
to be an error but I’m not sure what I’m missing

"let codingFact;

codingFact = favoriteLanguage + " was created in ten days by Brendan Eich";"

1 Like

I explained here:

Do you know how to do this? I noticed that you declared all of your variables without assigning them on the same line.

An example:

let variable = "this is a test";