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

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,887 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.