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 trialSolomon Jordan
Courses Plus Student 699 PointsFor some reason the code in my workspace is'nt working. When I save my file and try to preview the code I get no alert
This is the code i'm writing in my workspace. But I just get a blank page. Keep in mind I have a macbook. Should I change some type of setting? Thanks!
var message = "Hello!"; alert("message");
5 Answers
Gary Haag
Courses Plus Student 1,314 Pointstake the quotes off the alert message and it should work fine
Adrian Navarro
7,424 Pointsvar message = "Hello!";
alert(message);
Remove the quotes from the variable: message. That should solve the issue; right now you should be getting an alert saying "message"
Karen Melcher
1,324 PointsI did this but I still get no message at all.
Alexander Davison
65,469 PointsCan you press command-shift-i after you run the project? Once you do that, do you see any text in red?
Luis Soto
1,913 Pointsconfirm if your browser have an option to enable or disable javascript
Erin Agobert
4,781 PointsThis is going to seem really weird, but I was having the same problem with the exact same code after removing the quotes. This was my solution:
Old Script: var message = "Hello!"; alert(Message);
Note the capital "M" in the word "Message". Once I changed to "m" the script was able to execute.
New Script: var message = "Hello!"; alert(message);
Adrian Navarro
7,424 PointsAdrian Navarro
7,424 PointsOther than my answer please let us know if you are using an external js file or an script tag directly in the html document. If nothing is happening then your code is not being executed.
try this in your HTML file above your ending body tag:
If you are using an external js file then make sure you are calling the file in your html. Inside your <head> tag add something like:
<script src="yourfilename.js"></script>