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

Conner Williams
PLUS
Conner Williams
Courses Plus Student 3,305 Points

why is the preview function in the workspace not functioning properly?

after writing the first three lines of code as instructed and hitting the preview button, my browser just displays a web page with one white rectangular box and no text. No alerts were presented either.

3 Answers

Andreas Nyström
Andreas Nyström
8,879 Points

Hi.

Did you write it correct? Please do copy your code for us to see in future questions here. Makes it alot easier. The other thing could be that you forgot to save the file before previewing it.

Hope this helps, if not. - Ask again! :)

My page looked the same as Conner's after writing the first three lines (just a white rectangle at the top). Then I realized I forgot to put quotation marks in the first line. I should have written:

alert("Hello from Treehouse");

I had written:

alert(Hello from Treehouse);

Once I added the quotation marks, then the other lines of code worked and my page looked the same as the video.

I hope this helps.

Gigi Montgomery
Gigi Montgomery
4,706 Points

Hi, this is super late, but I just started this course and was having the same problem and found I was missing a quote, despite looking over it again and again.

alert("Hello from treehouse"); document.write("<h1>Welcome to JavasScript Basics </h1>"); alert("<h1>Thanks for visiting.</h1>");

Hope this helps.