When including comments in your code, you will most often use single-line comments. Single-line comments start off with two forward slashes (
//this is a single-line comment var i = 1; //and this is a single-line comment //This comment is spanning //more than a single line, //three lines to be exact.
There are a couple reasons why you will be using these comments more frequently than multiline comments. First, you can use single-line comments across multiple lines like demonstrated above. And secondly, single-line comments are more difficult to confuse with regular lines of code. The disadvantage of multiline comments is that if the comment is too long, you will have to take an extra second to find the starting and ending comment delimiters - (
*/. With single-line comments, this is not a problem. Just look to the left of the comment to find the double forward slashes (