Comments
Purpose of Comments
Comments allow us to do the following:
Communicate with other developers by writing notes in plain English.
Annotate certain aspects of our code for our future selves.
Add TODOs in our code.
There are two ways to do comments in JS.
Single Line Comments
Multiple line comments
Single Line Comments
Two slashes //
will allow you to do a single line comment. See the example below:
Multiple Line Comments
A /**/
will allow you to do multi-line comments. Anything inside the asterisks will be commented out and will not execute.
File Location
Practice
In
comments.js
go ahead and create a variable called myAge.Add a single line above the variable.
Print the variable to the console.
Above the print statement, add a simple multi-line comment.
Last updated