What is the difference between single-line and multi-line comments in JavaScript?

Single Line comment

The following is a single line comment in JavaScript. Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.

// This is a comment. It is similar to comments in C++

Multi-Line comment

The following is a multi-line comment in JavaScript.

   * This is a multiline comment in JavaScript
   * It is very similar to comments in C Programming

Updated on: 12-Sep-2019


Kickstart Your Career

Get certified by completing the course

Get Started