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) Introducing JavaScript Your First JavaScript Program

I also have nothing showing up in the preview?

Entering all the code and the preview just shows a blank page with a blank box. No alerts, no text. I've read through the people asking the same question below but none of those solutions seemed to help... here's my code: alert("hello"); document.write(<h1>"Welcome"</h1>); alert("thank you!");

4 Answers

Do you have those commands within a set of script tags in the body of the document like this?

alert("thank you!");
Javier Alvarado
Javier Alvarado
16,060 Points

Did you save before you hit the preview button? I didn't see anything either until I saved the file. Make sure there isn't an orange dot by the file name so you know that it's saved.

Daniel Mejia
Daniel Mejia
12,481 Points

You need to add the h1 tag to the "document.write" code.

document.write("<h1>Welcome to JavaScript Basics</h1>");

Edit: You're right Marcus Parson, I missed that. Thank you! :)

Adding any kind of HTML tags to document.write() won't help if the text doesn't show up, Daniel.

Calum Hartley
Calum Hartley
6,959 Points

It didn't work for me the first time because I realised that javascript is case sensitive. So Document.write didn't work but document.write did work.

It prompts you with the capitalised version.