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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Jim Andrews](https://uploads.teamtreehouse.com/production/profile-photos/10254812/micro_13419204_10154224607439414_6314176225575574009_n.jpg)
Jim Andrews
5,967 PointsUsed += instead of inline concatenation to make my "story" variable print the whole thing. Good or bad?
So instead of using the inline method of concatenation, I just kept updating my "story" variable, then printed that to the screen so my document.write() could be short and I could avoid this big long line of text to search through for potential errors. Thoughts? Right or wrong? Will this method cause the browser to work slower (I guess this is the real question)?
var noun = prompt("Give me a noun.");
var verb = prompt("Give me a verb.");
var adjective = prompt("Give me a adjective.");
var story = "";
story += "Once upon a time there was a great big ";
story += noun;
story += ". The ";
story += noun;
story += " would ";
story += verb;
story += " very ";
story += adjective;
story += ". Thanks for reading!!!";
document.write(story);
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThis method is essentially equivalent to what you started with, and as you point out can make the code easier to read and maintain. You might also consider a mix of the two, assembling a sentence or phrase at a time, but not so much to make the line overly long.
Good job, applying your new skills creatively!