JavaScript JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

Conner Williams
PRO
Conner Williams
Pro 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,878 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.