Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!!

Pavon

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.

Pavon