7 Comments in Javascript – JS for Beginners

Learn Javascript from Scratch

Last updated on June 30th, 2018 at 09:53 pm

 

This video is taken from the full course that will teach you HTML, CSS, Programming concepts and Javascript .

Video Transcript:

 

Hi.

Okay, so like any other programming language, you’ll find yourself using comments in JavaScript.

And there are single-line and block comments.

So a single-line is just two forward slashes.

 

Watch Full Course >>

 

And then for a block comment, it is one single forward slash, an asterisk and an asterix and a forward slash.

So if I want to add a comment here, I can just add it there with forward slash there.

That’s a comment.

That’s a single-line comment.

And this will not be executed.

It is just a comment that will let someone else reading the code know what’s happening.

So that’s a single-line comment.

You can also have, you can also have the block comment.

So there.

So comments are useful.

They can help you understand what it is that you’re doing, especially when you’re writing lots and lots of code.

You can use comments to explain what you’re doing so that when you come back to the code in future, you will know what it is you were trying to do.

Because in most cases, you’ll find you write a lot of code and if you write a lot of it and there’s no way for you to remember what it is you were trying to do, you’ll have a hard time trying to figure out what exactly that code does.

So you can use comments, by single lines or you can use a block comment such as this one.

Let’s continue in the next video.

 

Watch Full Course >>

 

This section is from Learn Javascript from Scratch.

Learn Javascript from Scratch

Comment Here