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 trialLarissa Röhrig
1,787 PointsMy story doesn't work. Why do I get the message "NOT FUND" ?
All my prompt commands pop up on the display but at the end the page loads again and there is the message "NOT FUND"... What did I wrong?
var colour = prompt("What's the first colour you can think of?"); var feeling = prompt("What's the first feeling you can think of?"); var activity = prompt("What's the first activity to can think of?"); var location = prompt("What's your favourite place?"); alert("You have finished this game!"); var story = "Once upon a thime there was computer who wanted to tell you a story " + "The computer was obsessed withe the colour " + colour + "Every time the computer saw the colour he felt strong " + feeling + "After seeing the the colour the computer startet to " + activity + "For doing so the computer always went to " + location + " At the end the computer started to die because he was out of battery" ; document.write(stor
1 Answer
Simon Coates
28,694 Pointsi ran:
var colour = prompt("What's the first colour you can think of?");
var feeling = prompt("What's the first feeling you can think of?");
var activity = prompt("What's the first activity to can think of?");
var location = prompt("What's your favourite place?");
alert("You have finished this game!");
var story = "Once upon a thime there was computer who wanted to tell you a story " + "The computer was obsessed withe the colour " + colour + "Every time the computer saw the colour he felt strong " + feeling + "After seeing the the colour the computer startet to " + activity + "For doing so the computer always went to " + location + " At the end the computer started to die because he was out of battery" ;
document.write(story);
and got
Once upon a thime there was computer who wanted to tell you a story The computer was obsessed withe the colour blueEvery time the computer saw the colour he felt strong despairAfter seeing the the colour the computer startet to lion tamingFor doing so the computer always went to https://www.google.com.au/_/chrome/newtab?espv=2&ie=UTF-8 At the end the computer started to die because he was out of battery
The output reflects the problem with having a variable called location (my location var was google.com when i ran the code).
Larissa Röhrig
1,787 PointsThank you Simon for taking the time to help me! That helped a lot!
Simon Coates
28,694 PointsSimon Coates
28,694 Pointsyou definitely shouldn't have a variable called location. The (existing) location variable is meant to be the location of the current browser window. (try calling the variable 'place' instead)
If document write doesn't work, you could just alert.