Previous Next

JavaScript Comments

JavaScript comments are explanations or remarks within the code that are not executed or processed by the browser. They are just there to aid developers in interpreting the code.

There are two types of comments in JavaScript:

Single Line Comments

Single-line comments begin with //. Anything between // and the end of the line is ignored by JavaScript.

Example:

let name = john;
// This is a single line comment
console.log(name);

Multi-line Comments

Comments in multi-line mode begin with /* and end at */. Any information between /* and */ will be ignored by JavaScript.

Example:

let name = john;
/* This is a
multi line
comment */

console.log(name);
Previous Next