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 Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

bobcat
bobcat
13,623 Points

My variable challenge offering

I am not sure about the spaces after my variables but the program works like its supposed to.

var first = prompt('Choose a colour ');
var second = prompt('Choose an animal ');
var third = prompt('Choose a food ');

alert('Well done jackass you have finished, now read the story');

var message = 'You again? Well it turns out that you have decided to eat a ' + first + ' ' + second + ' ' + third + ' ';

message += 'so you must have serious issues!';

document.write(message);

1 Answer

Charlie Jaime
Charlie Jaime
17,351 Points

var first = prompt('Choose a colour'); var second = prompt('Choose an animal'); var third = prompt('Choose a food');

alert('Well done jackass you have finished, now read the story');

var message = 'You again? Well it turns out that you have decided to eat a ' + first + ' ' + second + ' ' + third;

message += ' so you must have serious issues!';

document.write(message);

I did very minor changes you just have extra spaces thats all, I wish JavaScript would have interpolation like ruby the would be so mush easier to type of long string with var information

if you like my answer vote me up or mark for the best answer thank you and great coding!