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

Raphael Reiter
Raphael Reiter
6,820 Points

Code doesnt work

I am writing the same line of code.

I have deleted all my history, I have tried on different browsers for the last 45 minutes. This is so annoying!! it is not working at all !!!

alert("Hello from treehouse"); document.write(<h1>Welcome to Javascript basics</h1>);

these two lines do nothing...

8 Answers

Michal Weizman
Michal Weizman
14,050 Points

Hi Raphael, I don't see anything wrong with the first line of code. However, the second is missing Quotation Marks like so:

alert("Hello from treehouse");
document.write("Welcome to Javascript basics");

I hope this helped.

Been thwarted by this too. Not encouraging as it's the first lesson and no response from TreeHouse for over two weeks...

Jacob Neulight
Jacob Neulight
1,099 Points

It works for me only after refreshing the page. Simply clicking the preview button isn't enough. Your also might need to tell your adblocking to add an exception for Treehouse's site.

Nick Weight
Nick Weight
1,890 Points

Refreshing the page is only way I got the preview to work as well.

Aniko Hegedus
Aniko Hegedus
6,082 Points

The workspace doesn't work for me either. :( It just opens a blank page no matter what I try.

Aniko Hegedus
Aniko Hegedus
6,082 Points

It does work in Chrome but not in Mozilla.

Michael Kalmykov
Michael Kalmykov
8,919 Points

alert("Hello from treehouse"); document.write("Welcome to Javascript basics");

Doesn't work for me either out of workspace, but same code works fine out of my own local set up. I think there is a bug with workspace where JS isn't initializing, console shows no errors when i inspect from chrome

Clovis Shropshire
Clovis Shropshire
7,139 Points

Code is right, the workspace just doesn't work :(

For me the problem was simply that I did not add the second and closing quotation mark in the alert() statement.