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) Introducing JavaScript Using the Console


this is tough help please help me

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script>console.log("Begin Program"); 

document.write console.log('Begin Program');


Correct code is:

    console.log("Begin Program");
    document.write("Welcome to JavaScript Basics");

Hope this helps.

Jesus Mendoza
Jesus Mendoza
23,288 Points

I recommend you to watch the videos over and over until you understand everything

1 Answer

14,636 Points

This is the 2nd thread for the same problem you're having and I think I understand your confusion.

In the first part of the challenge it says "at the beginning of the script on line 9, enter the code that will print "Begin program" to the console". However, on the 2nd task it says this..

"At the end of this script after the document.write(), type the code required to print 'End program' to the browser's JavaScript console."

You, like a good student, read the instructions and said "ok, I shall do that... you want it after document.write()? I'll put it after document.write()"

And so, that's what you did. You put console.log(&lsquo;End program&rsquo;) literally right after document.write()

The thing is, that's not how it works. Each individual command needs to be on its own line. That's just how it works.

document.write() is one command and console.log() is another command.

When they say "at the end of the script after document.write()" they mean "at the end of the script, on the next line after document.write()". If they want you to put something on the same line in the future (like when you'll be learning concatenation and method calls) they'll use the proper terminology that lets you know it needs to be added to the same line or they'll literally instruct you to "on the same line, line #, add so and so code". But in the future, when they say "after" they most certainly mean "on the next line".

Hope that cleared things up for you!


Huck - :sunglasses: