How to Comment JavaScript Code

Introduction

 
When we write JavaScript code we need to comment sometimes to state description or text or some explanation while writing the code, we need to comment on some lines in the code.
 
There are two types of comments,
  1. Single line
  2. Multi-line
For the Single-line comments, you can use “//”.
 
As for example
  1. //This is a variable  
  2. var x = 0;  
  3. var x = 0; // This is a variable  
  4. For the Multi line comments, you  
  5. /* 
  6. Here you can comment multiple lines within them 
  7. */  
  8. As  
  9. for example  
  10. /* 
  11. This is a variable 
  12. This is a variable 
  13. This is a variable 
  14. This is a variable 
  15. */  
  16. var x = 0;  
Keep learning, Cheers !