Hello and welcome to this video.
I'll be explaining how to use comments in your program called what are called Comments good comments
are busy clean text that you write inside your code to explain certain aspects of your code comments
you're right in your code and not really useful to the computer itself but they are useful to you as
the programmer or developer and to others who may have to look at your code add some other time.
Sometimes you may write some code and maybe three four weeks or even a few months down the line.
Come back to look at the code some parts of it may not make sense so if you leave comments in your code
to explain why certain aspects of your code does what he does then he may jog your memory as to why
you wrote that quote.
It also helps others who may have to look at your code at some other time.
So apart from writing programs that work correctly is also used for and that programs make sense when
someone examines your code.
You can also use chord comments for testing purposes.
There may be some aspects of your code that you may not want to be executed and you can implement that
by using comments.
There are two main types of comments used in the javascript programming language.
Every programming languages have their own way of inserting comments in javascript.
The way you insert comments is either on a single line of code or you can instead comments on multiple
lines of court so you have a single line comment which is represented by day to false lashes or multiple
line comments where you start the first line with a four slash and an asterisks and then everything
in between the up in unclosing asterisks will be provided us comments are when the code is executed
and the computer completely ignores the comments.
Comments can explain why and also what certain aspects of your code is doing.
Is it has a good programmer to focus more on why a certain aspect of the code not what but you can also
use it to explain why and also what my developer console.
I have caught some examples of comments and it doesn't really matter where you write your javascript.
I have I am the console or on a text editor.
Their comments will behave the same way so you can see here.
It is a variable I have declared given it a name given it.
That is a name and a variable name and I'm using this assignment operate on time assigning the value
of Rick so you can see here is the end of the statement.
And here you can see quote a single line comment.
So the comment basically says this stores the name stores name.
Okay so your comments should be meaningful to yourself and also to others so you can have a single line
comment at this side like up on here.
After tar me state meant us end it the computer when B could execute it all.
To run this line.
Ignore the comment on this line where you got just the comment here.
If the computer can't execute this block of code it will completely ignore the line.
This line here so we can see how this all turned green.
So that means this line will be ignored.
You can see this doesn't turn green because the comments started from here.
So there are two ways you can put the comment either on the side of the code or just before you can
see here.
This is a complete cut so no comment there here.
Well a multiple line comment.
So the comment spans two lines so you can have multiple line comments to span several lines so this
is the opening and this is the closing.
If you have been multiple line comment very important to close them properly.
The way I have done that so you can see here this block of cordice or turn green.
It'll be ignored in the computer.
Ron's or execute the program.
So this it's okay.
And there's no comment here.
This bizarre clip here this comment describes what this function does.
All writes of a process and to see the functionless execute as saying hellowallet I just typical K to
exit.
So that is basically how comments work in javascript or programming languages have their own way of
implementing comments.
But this is how javascript does it.
Thanks for watching.
Bye for now.