Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

Tell us what’s happening:

Test is not passing and showing error below:
SyntaxError: unknown: Unexpected token, expected “,” (19:96)

17 | console.log(codingFact);
18 |

19 | console.log(“It was fun sharing these facts with you. Goodbye!” +botName+ “from”+botLocation+“.”;
|

Your code so far


console.log("Hello! I'm your coding fun fact guide!");
let botName="Rianna";
let botLocation="UK";
let favoriteLanguage="Java";

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

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

console.log(codingFact);

 codingFact="I have studied "+favoriteLanguage+ " in my mastered degree in past many years ago.";
console.log(codingFact);

codingFact="I always enjoyed programming in "+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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0

Challenge Information:

Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

What are you missing before the semicolon?

1 Like

Thanks I put closing bracket but it still showing error as :

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).” and add the values of the variables.

I believe I did all what it say.

Why have you enclosed favoriteLanguage in parentheses?

“It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation).”

What is missing in your message compared to the message in the instructions. Careful with spacing!

Corrected that too but it still showing line 14 and 15 error.

What does your output look like?

As below:

// running 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)." and add the values of the variables.
// tests completed
// console output
Hello! I'm your coding fun fact guide!
My name is Rianna and I live on UK.
My favorite programming language is Java.
I have studied Java in my mastered degree in past many years ago.
I always enjoyed programming in Java.
It was fun sharing these facts with you. Goodbye!-Rianna from UK.

Please share your updated code.

Sure:



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

let botName="Rianna";

let botLocation="UK";

let favoriteLanguage="Java";



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



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



console.log(codingFact);



 codingFact="I have studied "+favoriteLanguage+ " in my mastered degree in past many years ago.";

console.log(codingFact);



codingFact="I always enjoyed programming in "+ favoriteLanguage + ".";

console.log(codingFact);



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

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 (').

  1. You should log "It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation)." to the console as a farewell statement from the bot.

Can you spot the differences?

If its space after Goodbye then I have added it and it looks like this now:

It was fun sharing these facts with you. Goodbye! - Rianna from UK.

But error still there.

Looking good?

What error?

If you’ve changed your code and still need help you need to share your updated code.

Updated code:


console.log("Hello! I'm your coding fun fact guide!");
let botName="Rianna";
let botLocation="UK";
let favoriteLanguage="Java";

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

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

console.log(codingFact);

 codingFact="I have studied "+favoriteLanguage+ " in my mastered degree in past many years ago.";
console.log(codingFact);

codingFact="I always enjoyed programming in "+ favoriteLanguage + ".";
console.log(codingFact);

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

Output as below:

// running 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)." and add the values of the variables.
// tests completed
// console output
Hello! I'm your coding fun fact guide!
My name is Rianna and I live on UK.
My favorite programming language is Java.
I have studied Java in my mastered degree in past many years ago.
I always enjoyed programming in Java.
It was fun sharing these facts with you. Goodbye! - Rianna from UK.
1 Like

Sometimes a mistake made earlier in the task affects later items. This can result in mis-leading or hard to understand results from the tests.

Please review each User Story in order and make sure it was implemented as instructed.

You mean there is no error in updated code you can see , sorry! And I should try to redo it just in case.

There is an error, yes. You don’t need to redo the whole thing.

Please review each User Story in order and make sure it was implemented as instructed.

Read User Story #1 (Not TEST 1, the User Stories).

Check the code and make sure it was done correctly.

Then go to User Story 2

This is how to find the error.

1 Like

Thanks a lot its passed now:)

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.