Locked lesson.
About this lesson
Understanding the instructions that are executed by the web browser, and learning how to comment code.
Exercise files
Download this lesson’s related exercise files.
Statements and Comments.docx58.8 KB Statements and Comments - Solution.docx
58.9 KB
Quick reference
Statements and Comments
Every line of code is a statement. Comments are important for code clarity.
When to use
You should always get in the habit of commenting your code. Always!
Instructions
The most basic way to create a comment is with two forward slashes //
Anything after the // is a comment, within that line.
You can also have multiple-lined comments.
/*
This is a comment
It's on more than one line
*/
Hints & tips
- Comments are important!
- Single line comments start with //
- Multiple line comments look like this /* comment */
Lesson notes are only available for subscribers.