JavaScript Tutorial

Define JavaScript

JS Arithmetic Exercise

JavaScript Comment

JavaScript Variable

JavaScript Operators

Conditional Statements

Logical Operators

JavaScript Slider

JS Login Form

JS Popup Boxes

JavaScript Loops

JavaScript Arrays

JS Mouse Events

JS Keyboard Events

Styling Elements

External JavaScript

JS Noscript Tag

JS String Functions

JS Math Functions

JS Random

JS Date Functions

theme-changer

JS Assignment

JS Question-Answer

Page Stats

Visitor: 556

JavaScript Comment

JavaScript comment are the statements which are not executed and are ignored by the browser. Any statements written as comment will not be visible to user, it indicates the purpose of code so that code can be easily understand even if we check it later on.

There are 2 types of comments in javascript:

  1. // - Single-line Comment.
  2. /* */ - Multi-line Comment.

Single-line comment: starts with //. Any text that starts with // (double slash) and ends in a line, will be concidered as single line comment.

Multi-line comment: start with /* and ends with */. It can go on multiple lines.

Any number of comments can be placed anywhere in the program.