Welcome to the Treehouse Community
Looking to learn something new?
Chany Ventura2,209 Points
var myName = "Chany" var myAge = 31 var message = "Chany + is + 31" alert("Chany" + "is" + "31"); What's wrong?
It says I have to leave an space before and after the word "is" I DONT GET IT
var myName = "Chany" var myAge = 31 var message = "Chany + is + 31" alert("Chany" + "is" + "31");
Stanley Thijssen22,831 Points
Hi there Chany, first of all everything you put in between double quotes ("") will be a string and the variable assigned to it will be exactly equal to that string. So for example your message variable now has the value:
"Chany + is + 31"
It would be better practice to reuse the variables you assigned before that, so:
var message = myName + " is " + myAge;
As you can see here I reuse the variable you defined earlier, and also used the string " is " with a space prepended and appended to it. This makes sure you get back a value like:
"Chany is 31"
After you have defined your message variable you can simply pass it to the alert() function like so:
I hope this helps you out and makes you understand better how to combine variables with strings (concatenation).