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 JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Muneer Bhamani
Muneer Bhamani
1,825 Points

story.js doesn't load. Please HELP!

Here is my program:

alert("Welcome to Madlibs!");
alert("Let's have some fun!");
var noun = prompt("Please type a noun.");
var verb = prompt("Please type a verb in the past tense.");
var adjective = prompt("Please type an adjective.");
var adverb = prompt("Please type an adverb.");
alert("You're done!");
document.write("<h2>A Day At The Zoo!</h2>");
document.write("<p>Today I went to the zoo. I saw a " + adjective + noun + " jumping up and down in it's tree. He " + verb + " " + adverb + " through the large tunnel that led to its " + adjective + " " + noun "." </p>");

Moderator Edited: Add Markdown so the code is readable in the Community Post. Please, in the future, refer to the Markdown Cheatsheet on how to properly post code in the Community.

8 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

I think you are missing a "(quotation mark) near the end. Have a look at the formatted code and see where the error highlighting is.

:) :dizzy:

Yes. Delete the quote mark before the final </p> and after the period.

Mark Pryce
Mark Pryce
8,804 Points

I do believe Jason is right, you need to include your </p> tag in quotation marks, either include it inside the period string or concatenate it on the end.

document.write("<p> This is just an example " + example + " of html tags inside of quotation marks. </p>");

As far as I am aware html tags will only work within a string. your browser will still treat it as html :)

Make sure you link your script to your index.html inside <script>

Happy coding.

Story.js also doesn't load for me.

document.write("<p>Today I went to the zoo. I saw a " + adjective + noun + " jumping up and down in it\'s tree. He " + verb + " " + adverb + " through the large tunnel that led to it\'s " + adjective + " " + noun + "." + "</p>");

If you have not resolved this already, try

  • escaping it\'s
  • adding a " + " like above after noun.
  • enclosing the closing </p> in ""

Hope this helps Cheers.

Michael McGraw
Michael McGraw
1,402 Points

Tanya Staples did you create the file 'story.js' in the root directory?

Muneer Bhamani
Muneer Bhamani
1,825 Points

I tried your suggestions but still no resolve. The alerts, prompts and document.write aren't loading.

Alisha Evans
Alisha Evans
1,527 Points

Muneer Bhamani did you try removing the paragraph tags altogether from the 2nd document.write statement?

Did you link the script file in the html document?

<script src='story.js'></script>

I think this is placed below the link in the header and before the title.

Kyle Griffith
Kyle Griffith
587 Points

Right click on the left side of the Workspace and create a new file and name it " story.js" then copy and paste the code you already made into that. That's what I had to do and it worked for me.