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 (Retired) Making Decisions with Conditional Statements Introducing Conditional Statements

document.write(); Is not displaying

No message is displayed with the code

3 Answers

Steven Parker
Steven Parker
220,464 Points

Be aware that anything done by "document.write();" will only be seen after the program finishes. If you need to see messages while the program is running, use "alert" or "console.log" instead.

If that's not the issue and you're still having trouble, please show your complete code.

Steven Parker
Steven Parker
220,464 Points

In the example the variable created is named "aswer", but it's referred to as "answer". So the test was never true.

Either one will work, but they must be the same.

var aswer = prompt(" What programming language is the name of a gem?"); if ( answer === 'Ruby') { document.write("<p>That's right!</p>"); }

Thank you so much