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) Making Decisions with Conditional Statements Document Your Code With Comments

Another way to write a comment.

if (correctGuess) {
    document.write/*document.write is used to write statements on the page*/('<p>You guessed the number!</p>');
}

1 Answer

Steven Parker
Steven Parker
231,271 Points

:point_right: You've discovered the Multi-line comment format:

// While this comment is in force to the end of the current line

/* A comment like this can span multiple lines,
   or as in your example, can comment out a portion of a line
   with code on both sides.
*/

Wouldn't mine still be a single line comment?

Christopher, even though your comment only uses a single line, you formatted it as a multi line comment. This means that you can put multiple lines in the comment. If you would have used the single line syntax, you would be limited to one line of comment.