Build a Sentence Maker - Build a Sentence Maker

Tell us what’s happening:

After double checking the code, asking others and searching online. My code still showing error. What should I do. The syntax is correct but still showing format error for ‘firstStory’ variable, while same format is working for second variable ‘secondStory’ in same code.

Your code so far

let adjective = "big", noun = "Dragon", verb = "sleeping", place = "cave", adjective2 = "fierce", noun2 = "meat";

let firstStory;

firstStory = "Once upon a time, there was a(n) "+adjective+" "+noun+" who loved to eat "+noun2+". The "+noun+" lived in a "+place+" and had "+adjective2+" nostrils that blew fire when it was "+verb+".";

console.log("First story: "+firstStory);


adjective = "Strong", noun = "Gaint", verb = "angry", place = "mountain", adjective2 = "big", noun2 = "fruits";

let secondStory = "Once upon a time, there was a(n) "+adjective+" "+noun+" who loved to eat "+noun2+". The "+noun+" lived in a "+place+" and had "+adjective2+" nostrils that blew fire when it was "+verb+".";

console.log("Second story: "+secondStory);

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 Sentence Maker - Build a Sentence Maker

you should initialize the variable, do not declare it and then give it a value later

tried that too didn’t work

show your update code please

oh, you also need to use a let keyword for each variable, the test doesn’t recognise the way you have written for variable initialization

1 Like

Now it works thanks :grinning_face:. But I have a question, why did it work for second variable?

because the starting value of these variables:

is different than the value after al the code is run, so the tests use an hacky way to get the values from these and check the value of firstStory
this hacky way recognise only the standard let name = value;, but the test is being changed to be more flexible

ok thank you for your support and explanation.