Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

Tell us what’s happening:

Step 8 is telling me to do what I’ve done already ?

Not sure if its something I’m doing wrong if anyone can help or give me a tip.

Your code so far

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

let botName
let botLocation
let favoriteLanguage

botName = "Brain"
botLocation = "The Mind"
favoriteLanguage = "Js at the moment"

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

console.log("My favorite programming language is " + favoriteLanguage + ".")

let codingFact

codingFact = "Python is harder to me then " + favoriteLanguage + "."

console.log(codingFact)

codingFact = "Css is also a bit harder then " + favoriteLanguage

console.log(codingFact)

codingFact = "All together after years of learning off and on, I think I'm starting to like " + 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; rv:137.0) Gecko/20100101 Firefox/137.0

Challenge Information:

Build a JavaScript Trivia Bot - Build a JavaScript Trivia Bot

do this on a single line

Thank you for the help, can you explain to me why i had to do that on one line as opposed to the other code ?

//Example
let ex
ex = example

why
let ex = ex ?
just curious so i can know going further.

Semi-colons in JavaScript

The use of semi-colons to end a statement is basic to JavaScript.

give a value to a variable when created instead of on the next line is the standard, and it is what the tests are expecting you to do

the other way also work, but it’s not the standard

1 Like

I wouldn’t really call declaring variables up front non-standard, sure in this case, it looks a little unnecessary. But declaring all variable at the top and then assigning to them later isn’t that uncommon.

I mean it should pass, and we already have a test that checks for the variable declaration, so it does not seem necessary as part of the value assign checking test.

true, but declaring on one line and assigning on the next is quite uncommon

I’m not sure if that is true, considering multiple reassignments are happening after the declaration. Sure, if it was just a single declaration and assignment, it would be a little more odd.

In any case, if we did want a single declaration and assignment it should be in the requirements, otherwise it is just valid code we are failing to validate properly.

and that’s why you have opened an issue