Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Jessica Pehrson
Jessica Pehrson
1,648 Points

the story making game

I did every thing right and when I preview in workspace no prompts every pop up here is the instructions: The Stroy making game app:

  1. create a variable and capture input (Prompt("ask a question.") store input in a

variable)

  1. create a seperate variable for each piece of input (new variable for each

question)

  1. add and alert to the visitor theyre finished (alert "youre done")
  2. combine the input with other strings to create a message ("you said " +

response")

  1. Print the story to the browser window (document.write)

here is the mad lib i created:

"<h2> it was a {adjective}, cold november day. I woke to the {adjective} smell of

{type of bird} roasting in the {room in a house} downstairs. I {verb-past tense}

down the stairs to see if I could help {verb} the dinner. My mom said, see if

{relatives name} needs a fresh {noun}. so i carried a tray of glasses full of {a

liquid} into the {verb ending in -ing}room. When I got there, I couldnt believe

my {part of the body Plural}! there were {plural noun}{verb ending in -ing} on the

{noun}</h2>

here is my code:

var adjective = prompt('Please type an adjective'); var sentence = "<h2>it was a " + adjective; var altAdjective = prompt('Please type another adjective'); sentence += ', cold november day. I woke to the ' + altAdjective; var bird = prompt('Please type a type of bird'); sentence += ' smell of ' + bird; var houseRoom = prompt('Please type a room in a house'); sentence += ' roasting in the ' + houseRoom; var pastVerb = prompt('Please type a past tense verb'); sentence += ' downstairs. I ' + pastVerb; var verb = prompt('Please type a verb); sentence += 'down the stairs to see if I could help ' + verb; var relName = prompt('Please type a relatives name'); sentence += ' the dinner. My mom said, see if ' + relName; var noun = prompt('Please type a noun'); sentence += ' needs a fresh ' + noun; var liquid = prompt('Please type a type of liquid'); sentence += '. so i carried a tray of glasses full of ' + liquid; var ingVerb = prompt('Please type a verb ending in ing'); sentence += 'into the ' + ingVerb; var bodyPart = prompt('Please type a plural body part') sentence += 'room. When I got there, I couldnt believe my ' + bodyPart; var pluralNoun = prompt('Please type a plural noun'); var altIngVerb = prompt('Please type another verb ending in ing'); sentence += '! there were ' + pluralNoun + altIngVerb; var altNoun = prompt('Please type another noun') alert('All done. Ready for the message?'); sentence += ' on the ' + altNoun + '.</h2>'; document.write(sentence);

Jessica Pehrson
Jessica Pehrson
1,648 Points

i found some minor errors towards the end of my code but i fixed them in this and still no prompts pop up;

var adjective = prompt('Please type an adjective'); var sentence = "<h2>it was a " + adjective; var altAdjective = prompt('Please type another adjective'); sentence += ', cold november day. I woke to the ' + altAdjective; var bird = prompt('Please type a type of bird'); sentence += ' smell of ' + bird; var houseRoom = prompt('Please type a room in a house'); sentence += ' roasting in the ' + houseRoom; var pastVerb = prompt('Please type a past tense verb'); sentence += ' downstairs. I ' + pastVerb; var verb = prompt('Please type a verb'); sentence += 'down the stairs to see if I could help ' + verb; var relName = prompt('Please type a relatives name'); sentence += ' the dinner. My mom said, see if ' + relName; var noun = prompt('Please type a noun'); sentence += ' needs a fresh ' + noun; var liquid = prompt('Please type a type of liquid'); sentence += '. so i carried a tray of glasses full of ' + liquid; var ingVerb = prompt('Please type a verb ending in ing'); sentence += 'into the ' + ingVerb; var bodyPart = prompt('Please type a plural body part'); sentence += 'room. When I got there, I couldnt believe my ' + bodyPart; var pluralNoun = prompt('Please type a plural noun'); var altIngVerb = prompt('Please type another verb ending in ing'); sentence += '! there were ' + pluralNoun + altIngVerb; var altNoun = prompt('Please type another noun'); alert('All done. Ready for the message?'); sentence += ' on the ' + altNoun + '.</h2>'; document.write(sentence);

huckleberry
huckleberry
14,636 Points

Yoooo ...

You need to wrap that code with some backticks (the little ` key next to the 1 key on your number homerow) and the language it's in... like so

'''JavaScript

your code here

'''

I used comma's there as an example but you have to do backticks.

That will turn your code from that jumbled garbled mess, into something readable lol.

Cheers,

Huck - :sunglasses:

1 Answer

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 11,077 Points

Here is your code fixed:

var adjective = prompt('Please type an adjective');
   var sentence = "it was a " + adjective; var altAdjective = prompt('Please type another adjective');
    sentence += ', cold november day. I woke to the ' + altAdjective;
    var bird = prompt('Please type a type of bird');
    sentence += ' smell of ' + bird;
    var houseRoom = prompt('Please type a room in a house');
    sentence += ' roasting in the ' + houseRoom;
    var pastVerb = prompt('Please type a past tense verb'); sentence += ' downstairs. I ' + pastVerb; 
var verb = prompt('Please type a verb'); 
    sentence += 'down the stairs to see if I could help ' + verb; 
var relName = prompt('Please type a relatives name'); sentence += ' the dinner. My mom said, see if ' + relName; 
var noun = prompt('Please type a noun'); 
sentence += ' needs a fresh ' + noun; 
var liquid = prompt('Please type a type of liquid'); 
sentence += '. so i carried a tray of glasses full of ' + liquid; 
var ingVerb = prompt('Please type a verb ending in ing'); sentence += 'into the ' + ingVerb; 
var bodyPart = prompt('Please type a plural body part'); 
sentence += 'room. When I got there, I couldnt believe my ' + bodyPart; 
var pluralNoun = prompt('Please type a plural noun'); 
var altIngVerb = prompt('Please type another verb ending in ing'); 
sentence += '! there were ' + pluralNoun + altIngVerb; 
var altNoun = prompt('Please type another noun'); 
alert('All done. Ready for the message?'); 
sentence += ' on the ' + altNoun + '.';
 document.write(sentence);

Basically you just forgot to close a few of strings, so half of your code wasn't being read by the javascript interpreter, thus making your prompts not appear. So watch those quotations and don't forget to double check your code.

P.S. When entering code into a post please follow the template below:

``` [name of language (ie. javascript, java, html, css. etc.) without the square brackets] <enter code here (without angle brackets)>

you can find the "`" next you your 1 key at the top left of your keyboard (differs on configuration)