Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

Tell us what’s happening:

It won’t let me pass. I try changing my codes with let favoriteLanguage; from one line to separate lines. The codingFact log fine in console, so I don’t know what I did wrong.

Errors I get:
You should log to the console “My favorite programming language is (favoriteLanguage).” and add the variable to the string.
You should log codingFact to the console.
You should log to the console “It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation).” and add the values of the variables.

Your code so far

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

let botName = "botty";
let botLocation = "the ocean";

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

let favoriteLanguage; 
favoriteLanguage = "Python";
let codingFact = "My favorite programming language is " + favoriteLanguage + ".";
console.log(codingFact);

favoriteLanguage = "JS";
codingFact = "How is " + favoriteLanguage + ".";
console.log(codingFact);

favoriteLanguage = "Java";
codingFact = "What is " + favoriteLanguage + ".";
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 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36

Challenge Information:

Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-javascript-trivia-bot/66ed41f912d0bb1dc62da5dd.md at main · freeCodeCamp/freeCodeCamp · GitHub

please do not change the value of programmingLanguage

Thank you. I was able to fix the error by removing favoriteLanguage the 2nd and 3rd times.

But now I’m stuck on the last line, and can’t pass because of it. What does it mean by “add the values of the variables” as botName and botLocation are strings?
"console.log("It was fun sharing these facts with you. Goodbye! " + botName + " from " + botLocation + “.”);

it means in the string "It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation)." you should replace (botName) with the variable, and (botLocation) with the other variable

can you please post all your code again?

There are two ways you can format your code to make it easier to read and test:

  1. After you copy/paste your code into the editor, select it by dragging your cursor over it then click the (</>) button in the toolbar to automatically wrap your code in backticks. (You can click on the animated demo image below to enlarge it.)

  1. Manually add three backticks on a new line above your code and on a new line after your code. Note that a backtick is NOT the same as a single quote('). To find the backtick key on your keyboard, see this post.

To see changes to your post as you make them, you can click the (M+) button on the toolbar to bring up the rich text editor:

I’m still stuck on the last line/statement.

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

let botName = "Botty";
let botLocation = "the ocean";

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

let favoriteLanguage; 
favoriteLanguage = "Python";
let codingFact = "My favorite programming language is " + favoriteLanguage + ".";
console.log(codingFact);

codingFact = "What is " + favoriteLanguage + ".";
console.log(codingFact);

codingFact = "How is " + favoriteLanguage + ".";
console.log(codingFact);

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

are you sure this should be a codingFact?

Yes, I got pass the favorite Language part. I"m trying to figure out the last line statement to pass, which is giving me this error:
You should log to the console “It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation).” and add the values of the variables.

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

I am trying to point you to the issue, please check user story 4, it does not mention codingFact

I see that story 4 didn’t mention codingFact I try removing codingFact, and it give me 2 more errors: Is this causing the error for the last line?

You should use let to declare a new variable codingFact.
You should assign a value to codingFact for the third time that also contains favoriteLanguage, and log it to the console.

let favoriteLanguage; 
favoriteLanguage = "Python";
console.log ("My favorite programming language is " + favoriteLanguage + ".");

now that you have changed that, how many times are you giving a value to codingFact?

Only twice. After I remove codingFact from story 4 or the first time.

Sorry, this is my code now:

With 2 errors:
You should assign a value to codingFact for the third time that also contains favoriteLanguage, and log it to the console.
You should log to the console “It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation).” and add the values of the variables.

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

let botName = "Botty";
let botLocation = "the ocean";

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

let favoriteLanguage; 
favoriteLanguage = "Python";
console.log ("My favorite programming language is " + favoriteLanguage + ".");

//codingFact & log 1
let codingFact = "What is " + favoriteLanguage + ".";
console.log(codingFact);

//codingFact & log 2
codingFact = "How is " + favoriteLanguage + ".";
console.log(codingFact);

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

Nevermind and I finally got it to passed. Thanks a lot for all the help. I got it to passed by adding the third codingFact variable (copying and pasting with minor change). You’re a great help =).

//codingFact & log 3
codingFact = "This is " + favoriteLanguage + ".";
console.log(codingFact);