Javascript Tutorial #3 - Comments

Sometimes, code can get quite hard to understand and read if there's to much information at one time. So comments are things that you can type into your program that will be ignored entirely by the computer, like they don't exist.

There are 2 ways to do comments:

1. The single line comment:
Typing '//' will comment out the rest of that line of code
e.g. typing let score = 100; //The player's score starts at 100. will let the reader of the code know what's going on, and the computer will ignore everything after the semicolon.

2. The multi-line comment:
Sometimes, one line isn't enough to fit everything you want. This is where the multi line comment comes in. To do a multi-line comment, start it with '/*', and end it with '*/' as follows
/* This                       
is                               
a                                
multiline comment */ 
This is a good way to properly annotate your code.

CHALLENGE: Make a small project using the console and variables and put comments throughout the whole thing explaining everything that's happening.

If you have any questions, let me know in the comments section.
- Noah

Comments