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) 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
231,269 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
231,269 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