Syntax

JavaScript Write a Comment Syntax

In JavaScript, write a comment: adds single-line or multi-line comments — // line comment /* block comment */

Quick Answer

Syntax
// line comment /* block comment */
JavaScriptSyntax

Write a Comment

Code example
// line comment /* block comment */

Adds single-line or multi-line comments.

Learn More

How to write a comment in JavaScript

  1. Open your JavaScript file or editor.
  2. Copy the example, then replace its sample names and values for your code.

JavaScript Write a Comment Syntax

Use // line comment /* block comment */.

Related Syntax References

Frequently asked questions

What is the JavaScript syntax for write a comment?

Use this pattern: // line comment /* block comment */

Can I copy this JavaScript code example?

Yes. Use Copy code and adapt the example to your program.

Is this JavaScript syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify