What Is Comment
The comment is a readable explanation for the source code of any computer program. Comment used to make the source code easier for other humans to understand that properly.
> Comments make code more readable and understandable.
> Useful for a large team with lots of people.
> Recall projects part after a log of time.
> Add some design to your project’s code.
> It will attract the person who is watching your codes.
Types of comments
There are two types of comment.
1. Single-Line Comments
2. Multi-line Comments
Single Line Comments
Single line comments start with //. Any text between // and the end of the line will be declared as a comment.
First, place your cursor where you’d like to add the comment.
Then, use the VS Code comment shortcut :
If you want to comment a part of line, then simple add // at the starting point. If you hit CTRL + / , the full line will be comment.
When you will hit enter the comments system will be stooped and basic code will be started. So, if you want to add multi-line comments, you need to comments on the other lines again.
Multi Line Comments
Multi line comments start with
/* and end with
*/. Any text between
*/ will be declared as a comment.
*/ at the starting and
/* at the end.
# Most of the people use Single-Line Comments.
Function is a process of naming some work together and call them when it is necessary with the name. With function you can set the function/work of any element. Then when you will call the element, it will do its functional works.
Function | Note It
> In loop, the all elements/work comes at a time. but, in function when & where you call it, it will be come/start working.
> JS function can declared under a variable. For that, Js function called First Class Function.
> You can declare a function inside another function. Because function is a object.