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

Hi, treehouse! How can i set some space between 2 variables values. var message ='My car is ' +brandName + modelName?

My code:

var brendName = prompt ('Please enter your car brand name');

var modelName = prompt ('Please enter a model');

var modelYear = prompt ('Please type a model year');

alert('All done. Ready for the message?');

var message = "My car is " + brendName + modelName + ". Model year: " + modelYear; document.write(message);

How can i set a space between 2 variable values (brendName & modelName)? When i return values with document.write method it looks together.

1 Answer

var message = "My car is " + brendName + " " + modelName + ". Model year: " + modelYear; document.write(message);

Thank you very much, Ketan! :)