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 Combining Strings

piotr krysiak
piotr krysiak
5,496 Points

Problem with the challenge task

It is something wrong with the 1. Write another program, and 2. Capturing Visitor Input and Writing It to the Page. I wrote a corect code and got a wrong answer

Rich Donnellan
Rich Donnellan
Treehouse Moderator 27,671 Points

Provide your code if you'd like some help. Either use Markdown or link to a snap shot of your workspace.

2 Answers

piotr krysiak
piotr krysiak
5,496 Points

What did I do wrong?

<!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JavaScript Basics</title>
  </head>
  <body>
    <script>
       alert("Warning");
    </script>
  </body>
</html>
var answer = prompt("What day is today?");

Hi piotr krysiak,

I think this is the code you need:

var answer = prompt("What day is today?");
alert(answer);

The first line creats a dialog box and asks the question "What day is today". After the visitor answers, the value will be saved in the answer variable. After this is done you wil return the visitors feedback with an alert box;