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 trialSebastian Angelo-Perez
1,835 PointsMy Storymaker is done. is it a better/shorter way to do it?
var noun = prompt("say a noun"); var verb = "Say a verb"; var verb = prompt("You said " + noun + ", good! Now, " + verb); var adjective = "say an adjective"; var adjective = prompt("You said " + verb + ", your answer is correct! Now, " + adjective); alert("Great! You're finished");
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsYou could eliminate the first declarations for your 'verb' and 'adjective' variables, as they are not needed. What you have stored in the variable can just be put into the concatenation, and therefore makes it less 2 lines. :)
var noun = prompt("Say a noun.");
var verb = prompt("You said " + noun + ". Now say a verb");
var adjective = prompt("You said " + verb + ". Now say a adjective");
alert("Great! You're finished. You're story says '" + noun + " " + verb + " " + adjective + ".'");
Sebastian Angelo-Perez
1,835 PointsThanks Jason :-)