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 Quickstart Data Types and Variables Creating Variables

Date type and variables

Use the alert() function to display the contents of the message variable in a dialogue window.

How can I solve this?

scripts.js
var myName = "Shira";
var myAge = 33;
var message = myName + ' is ' + myAge;

alert ("message");

1 Answer

Charles Badger
Charles Badger
18,189 Points

remove the quotes from "message" in your alert.

When you type

alert("message");

you're telling JavaScript to display the string "message" in an alert.

If you were to use

alert(message); 

you would be telling JavaScript to display the contents of the message variable in an alert.

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Charles,

Just an FYI, since your comment correctly answers the question, I've converted it into an answer.

I also applied syntax highlighting to your code examples. It's especially helpful here as it draws attention to the fact that "message" and message are different types.

Cheers

Alex