JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Larissa Röhrig
Larissa Röhrig
1,787 Points

My 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

Simon Coates
Simon Coates
28,678 Points

you 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.

1 Answer

Simon Coates
Simon Coates
28,678 Points

i 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
Larissa Röhrig
1,787 Points

Thank you Simon for taking the time to help me! That helped a lot!