In the rest of this module we will use comments to help explain the code so
let’s look at how they work.
JavaScript supports two types of comments: single-line comments and multi-line
comments. Comments allow you to add notes or explanations to your code that are
ignored when the program runs.
Single-Line Comments
These comments start with // and anything after that point is treated as a
comment.
// This is a single-line commentletage=16;// This comment explains the variable
Multi-Line Comments
These comments start with /* and end with */. They can span as many
lines as you like.
/*This is a multi-line comment.It can explain a more complex piece of code.*/letperson="Alice";
3. Comments#
In the rest of this module we will use comments to help explain the code so let’s look at how they work.
JavaScript supports two types of comments: single-line comments and multi-line comments. Comments allow you to add notes or explanations to your code that are ignored when the program runs.
Single-Line Comments
These comments start with
//
and anything after that point is treated as a comment.Multi-Line Comments
These comments start with
/*
and end with*/
. They can span as many lines as you like.