Skip to main content
D
JavaScript
JavaScript Comments

JavaScript Comments

JavaScript comments leave hidden notes inside the code.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

JavaScript comments explain code logic to other developers. The browser completely ignores these comments when executing the program. Developers use them to organize complex files or temporarily disable code while testing.

Syntax

Syntax
1/* comment syntax */
2// Single line comment
3/* Multi-line 
4comment */

Key Points

  • Two slashes `//` create a single-line comment.
  • A slash-asterisk `/*` starts a multi-line comment.
  • An asterisk-slash `*/` ends a multi-line comment.
  • Comments prevent code execution.

Up Next

Continue your journey with the next topic.

Go to JS Variables