Check out a free preview of the full Introduction to JavaScript course:
The "Adding Comments" Lesson is part of the full, Introduction to JavaScript course featured in this preview video. Here's what you'd learn in this lesson's course:

Brian demonstrates how to insert comments into JavaScript code.

Get Unlimited Access Now

Transcript from the "Adding Comments" Lesson

[00:00:00]
>> Brian Holt: Okay, so right now on line four, were you saying friends at your party called friends at your party plus one. There's a bunch of ways to do this. And I'm gonna show you all of them, because you will see all of them. There's kind of just shorthand ways of doing that.

[00:00:13]
But I wanted to talk a second about comments first. So if I put slash slash, this is some comment to my future self.
>> Brian Holt: This is the way that you can document code, especially if you're doing something that's not immediately clear what you're doing, and you want to let your future self know, to have a shortcut to into your mindset, or your co workers.

[00:00:39]
Comments are good way of doing that. And the way you do that in JavaScript is with slash slash. And then whatever comes after the slash slash until the end of the line, will not be executed by JavaScript religious be skipped. Okay? The called comments, the other way you can do it is can do slash star, and then everything will be a comment until you do star slash.

[00:01:01]
So everything in here is a comment.
>> Brian Holt: The reason why I tell you that is, sometimes it is useful to comment out code.
>> Brian Holt: So here I've commented this code out by abusing the comment system, and just say, hey, don't execute this line, but I wanna leave it there for now.

[00:01:24]
So that's what this does. You can just do slash slash space in front of it, and you're good to go.