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
Ryan Bevilacqua
7,716 PointsThe Variable Challenge
Hi guys,
I am working on this challenge and my prompts are not popping up in the browser. (I'm using Chrome).
Does anyone happen to know what I'm doing wrong?
Thank you for your time.
var mainCharacter = prompt("What is your name?");
var fun = prompt("What is your favorite thing to do for fun?");
var city = prompt("Where is your favorite place in the world?");
var favoriteFood = prompt("What is your favorite food?");
var actor = prompt("Who is your favorite actor?");
var ex = prompt("Who was your most recent break up?");
var pastTenseVerb = Prompt("Write a past tense verb.");
var adjective = Prompt("write an adjective.");
var activity = prompt("write an activity.");
// story //
var story = "It was a bright and sunny day in " + city + "." " + mainCharacter + "was walking along thinking of " + fun + " when all of a sudden there was a food truck selling her favorite food," favoriteFood "." ;
Document.write(story);
Simon Coates
28,695 Pointsyou may be missing some string concatenation on the story declaration. I'm not sure but Document.write may be document.write().
3 Answers
Aaron Martone
3,290 PointsYour prompts are fine. However these lines:
var pastTenseVerb = Prompt("Write a past tense verb.");
var adjective = Prompt("write an adjective.");
var story = "It was a bright and sunny day in " + city + "." " + mainCharacter + "was walking along thinking of " + fun + " when all of a sudden there was a food truck selling her favorite food," favoriteFood "." ;
Document.write(story);
... all have errors. JS is case-sensitive. There is no such thing as Prompt(). It should be prompt(). There is also no such thing as Document, it should be document. Also, your syntax for setting story is invalid when it gets to ...selling her favorite food," favoriteFood ".";. It should read ...selling her favorite food, " + favoriteFood + ".";
Simon Coates
28,695 Pointsand
+ "." "
probably has an extra quote
mahmoud saeed
14,071 PointsYou need to reference the "document" object, not the "Document" object.
Ryan Bevilacqua
7,716 PointsThanks guys!!!! With your help I have passed this part.
Simon Coates
28,695 PointsSimon Coates
28,695 Pointsi copied it directly into the developer console in chrome. The first few prompts asked me for information, but then it seemed to not like your use of capital P on prompt.