by Sai gowtham

How to write comments in the JavaScript code

  • Comments help us to read our code better in the future in case if we forgot what is happening on the particular line of code.
  • Comments can be helpful to the other developers who try to read our code.
  • Comments are also used to stop running a particular line in the code.
  • Comments are ignored by the interpreter.

Let’s learn now how to write comments in JavaScript.

There are two ways to write a comments in JavaScript.

Single line comment

// this is a single line comment in JavaScript

Mutliline comment or Block comment

/*
this is a multi-line

comment.

Hope

you

love me

*/

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
26,545 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
221,520 students enrolled
44 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
114,575 students enrolled
21 hours of video content
View Course