WEEK: 2
Active: January 20th - January 26th
Work Due: January 27th @ 11:59 PM

Comments

You will use the console.log() function often throughout this semester and beyond. Printing information to the web console is an easy way to debug code and verify whether your programs are working.

You will also use comments a lot (I hope!) in all your code. Comments provide information about the code you are writing to you or another developer but not to the end-user. (i.e., it will not show up on the web page). They are essential for maintenance reasons. We want to be able to maintain our code and not think to ourselves, “That page is horrifying, and I never want to open it again!”.

There are two types of comments:

Single Line Comments This type of comment only comments out a single line (hence its name), but nothing else. They always start with two forward slashes.

The syntax is like this:

// This is a single line comment

Multi-line Comments Whereas multi-line comments allow you to span across multiple lines. These are helpful when you want to comment out some code or create a heading. The multi-line comment always starts with a forward slash and then a star and then ends with a star and a forward slash. Everything in between becomes a comment.

The syntax might look like this:

/*
Author: Michael Cassens
File Name: My Page.html
Date: Today's Date
Purpose: To explain comments
*/

Previous section:
Next section: