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
Chris Bryan
3,654 PointsCan somone help me on this please? I don't know what I'm doing wrong. None of the prompts are popping up when i preview
"<h2>There once was a [adjective] child named [name] he lived In a small town out by [place].</h2>"
var adjective = prompt('Please type and adjective') var sentence = "<h2>There once was a " + adjective; var name = prompt('Please type a name'); var place = prompt('Please type a place'); alert('All done now its story time!') sentence += ' child named '+ name; sentence += ' he lived in a small town out by ' + place + '.</h2>; document.write(sentence);
1 Answer
Martin Balon
43,651 PointsHi Chris,
there are few problems with your code - first - at first line there's a sentence wrapped in quotes which is not assigned to any variable. Second - you are missing semicolons after statements. This is what I came up - you can copy it and paste it into console and hit enter.
var adjective = prompt('Please type and adjective');
var name = prompt('Please type a name');
var place = prompt('Please type a place');
var sentence = "There once was a " + adjective;
sentence += " child named " + name + " he lived In a small town out by " + place + ".";
alert('All done now its story time!');
alert(sentence);