Two ways to write comments in JavaScript

Comments are lines of code that JavaScript will intentionally ignore. Comments are a great way to leave notes to yourself and to other people who will later need to figure out what that code does.

Using // will tell JavaScript to ignore the remainder of the text on the current line. This is an in-line comment:

// This is an in-line comment.

You can make a multi-line comment beginning with /* and ending with */. This is a multi-line comment:

/* This is a
multi-line comment */
0 0 votes
Article Rating
Was this article helpful?
YesNo
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
Scroll to Top