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

Saira Bottemuller
PLUS
Saira Bottemuller
Courses Plus Student 1,749 Points

Story Maker problem - What have I done wrong?

Hello everyone! I am doing the Story Maker challenge in JS, and I'm not sure I took the right approach. I would love any and all helpful feedback, because what I did is not working. I started this project after rewatching the video following a week-long hiatus from Treehouse (booooo!). If I've made multiple errors (how embarrassing!) please pick them apart one at a time. I need to learn, I won't cry. :) Here's the code for index.html, and I will post the JS code from my external file story.js below it:

index.html......i am having trouble getting my index.html code to post because the browser keeps trying to interpret it >_<

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<link rel="stylesheet" href="css/main.css">

<title>The Story Maker</title>

</head>

<body>

<div class="container">

<h1>The Story Maker</h1>

<script src="story.js">

</script>

</div>

</body>

</html>

===============================

story.js

<script type="text/javascript">

var firstSingleNoun = prompt("Enter singular noun:" , "Singluar noun");

var secondSingleNoun = prompt("Enter another singular noun:" , "Singluar noun");

var third SingleNoun = prompt("Enter one more singular noun:" , "Singluar noun");

var firstPluralNoun = prompt("Enter a plural noun:" , "Plural noun");

var secondPluralNoun = prompt("Enter another plural noun:" , "Plural noun");

var thirdPluralNoun = prompt("Enter one more plural noun:" , "Plural noun");

var firstVerb = prompt("Enter a verb" , "Verb");

var secondVerb = prompt("Enter another verb" , "Verb");

var thirdVerb = prompt("Enter one more verb" , "Verb");

var firstAdjective = prompt("Enter an adjective" , "Adjective");

var secondAdjective = prompt("Enter another adjective" , "Adjective");

var thirdAdjective = prompt("Enter one more adjective" , "Adjective");

alert("You've finished filling in the blanks! Let's read the story:");

var story = "There once was a " + " " + firstAdjective + " " + firstSingleNoun + " who loved to " + " " + firstVerb + " every single day."

</script>

===============================

Devin Scheu
Devin Scheu
66,191 Points

What are the errors that you are getting? If there are no errors and it's just that nothing is happening, it is probably because you just stored the story in a variable and never printed it out. You only sent a alert and nothing is following it because storing a variable is different then using a variable.

Hope This Help, Devin.

P.S. message me back if you are still having issues.

Devin Scheu
Devin Scheu
66,191 Points

Also you if you want to post code use three back ticks after another and write the language you are posting after it, then post 3 more back ticks at the end when you are done, it should be the key with the squiggly above your tab key.

Like this :D :

<!DOCTYPE html>

The Story Maker

The Story Maker
var firstSingleNoun = prompt("Enter singular noun:" , "Singluar noun");

var secondSingleNoun = prompt("Enter another singular noun:" , "Singluar noun");

var third SingleNoun = prompt("Enter one more singular noun:" , "Singluar noun");

var firstPluralNoun = prompt("Enter a plural noun:" , "Plural noun");

var secondPluralNoun = prompt("Enter another plural noun:" , "Plural noun");

var thirdPluralNoun = prompt("Enter one more plural noun:" , "Plural noun");

var firstVerb = prompt("Enter a verb" , "Verb");

var secondVerb = prompt("Enter another verb" , "Verb");

var thirdVerb = prompt("Enter one more verb" , "Verb");

var firstAdjective = prompt("Enter an adjective" , "Adjective");

var secondAdjective = prompt("Enter another adjective" , "Adjective");

var thirdAdjective = prompt("Enter one more adjective" , "Adjective");

alert("You've finished filling in the blanks! Let's read the story:");

var story = "There once was a " + " " + firstAdjective + " " + firstSingleNoun + " who loved to " + " " + firstVerb + " every single day."
Saira Bottemuller
Saira Bottemuller
Courses Plus Student 1,749 Points

Hey thank you Devin! :)

It's not giving me an error, it just never pops up my Prompt boxes to ask for any of the input. Will printing this to the screen fix that?

Oh thank you for the backticks thing, I was trying to use asterisks LOL :D

So, like this then?:

<a href="http://www.teamtreehouse.com">Treehouse is great!</a>``` 

Survey saaaays...
Devin Scheu
Devin Scheu
66,191 Points

Like this:

// Like this ```HTML  <Code Goes Here>  ```

Its not the squiggly but the other thing that is with the squiggly, :/ I don't know that name of keys very well but i think it is the back tick.

Devin Scheu
Devin Scheu
66,191 Points

Aha! I think i found it out, you third variable has a space in it, that is a no no :P.

Saira Bottemuller
Saira Bottemuller
Courses Plus Student 1,749 Points

OH MY goodness, Devin, you have solved the problem and saved the day! Not only did I have a space in my third variable, I had made a big copy/paste faux pas - I copied and pasted a line of code to save time...but didn't proofread it for typos/misspellings. I will take a lesson from these two mistakes and use it to focus harder next time! Thank you so much for your help, what a peach! :) :) :)