Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics Working with Strings Variables and Strings Challenge Solution

Zeke Swanson
Zeke Swanson
Web Development Techdegree Student 6,532 Points

Why is my prompt box not showing up when I run the code?

Here is my code:

const adjective = prompt('Please Type an Adjective.'); const noun = prompt('Please type a noun.'); const verb = prompt('Please type a verb.');

const message = <p>The ${adjective}, looking ${noun} came in and ${verb} all the cookies.</p>`;

document.querySelector('main').innerhtml = message;

In Firefox, after the first prompt, I got a checkbox in the prompt window that said "Prevent this page from creating additional dialogs", which, if you check it, no longer allows the site to prompt the user. In Opera, I needed to reload the page to get the prompts. Have you tried reloading your page or testing your code in another browser?

You might want to change innerhtml to innerHTML or create a paragraph in main and use textContent on it instead, but that shouldn't affect getting the prompts.

2 Answers

Aissa Toumi
Aissa Toumi
928 Points

you forgot the backtick at the beginning of the message variable