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 Solution

My story was coded differently but came out the same.

Here is my story.js file.

alert("Welcome To StoryMaker! Let's create your unique story!");
alert("Ready? Let's begin!");
var verb1 = prompt('Enter a VERB');
var noun1 = prompt('Enter a NOUN');
var time1 = prompt('Enter a TIME');
var place1 = prompt('Enter a PLACE');
var verb2 = prompt('Enter a VERB');
var noun2 = prompt('Enter a NOUN');
var verb3 = prompt('Enter a VERB');
var noun3 = prompt('Enter a NOUN');
var adjective1 = prompt('Enter an ADJECTIVE');
alert("Thanks for your words. Ready for your unique story? Here it is...");
document.write("My day tomorrow will be interesting. I intend to " + verb1 + " my " + noun1 + " at " + time1 + " AM. Next, I will go to the " + place1 + " to " + verb2 + " my " + noun2 + ". Then I need to " + verb3 + " my " + noun3 + " who is simply " + adjective1 + ".");

Is it bad I'm putting my entire story inside the document.write() parameter instead of doing it like the instructor suggest in his solution?

Thanks in advance to all who respond to this question. I thought this way would be easier but now I think I could have coded it a better way in case another programmer needs to modify my source code.

Amazing course by the way!!


1 Answer

Shlomi Bittan
Shlomi Bittan
6,718 Points

Hi Pavon, It is considered bad practice to use document.write(). Try to avoid it as much as you can. You should instead you html markup.

Hi there Shlomi!

First, thanks for responding to my question.

I will keep that in mind. I know the instructor did the same thing. You rock! And thank you once again.