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
Unsubscribed User
1,746 PointsIntroducing Variables - Stuck at the first hurdle
I have just started JavaScript Basics and I'm stuck at the first point and I can't figure out why it is wrong.
I am following along with the video word for word however when I create a variable and an alert -
var message = "Hello!"; alert(message);
The alert displays "Welcome to Treehouse"
This is the same when - alert("message") - has quotations
Heres a snapshot to my work: https://w.trhou.se/y99rbz2m0a
and a link to the workspace: https://teamtreehouse.com/workspaces/12133892
I'm fairly certain I'm not doing anything wrong, any help?
Thanks
3 Answers
Josh Keenan
20,315 PointsI have no idea what on earth the problem is, copied the code and I don't have the same problem, try refreshing the page?
Unsubscribed User
1,746 PointsI wasn't refreshing the page, something so simple!
I was just clicking"Preview Workspace" and thinking that was the script running, I'll know for future reference to hit refresh.
Thanks guys.
Josh Keenan
20,315 PointsHappy to help!
Unsubscribed User
30 PointsTry entering your javascript into the browser console. You shouldn't need quotes around the alert() method as that will cause your variable to be interpreted as a string.
var message = "Hello!"; alert(message);