Comments in JavaScript

Including comments in your code is highly recommended. They can not only help yourself but also help other developers quickly understand the code. JavaScript has two types of comments.

Single line comments start with //

Multi line comments start with /* and end with */.

function WDW() {
     var i = 0;    // reset the counter

           The block of code below
           does some crazy stuff. Best to shut your eyes during execution!


Want to become a better web developer?

Join over 25,000 other developer & designers who get awesome links to the best news and articles each week delivered directly to their inbox.

This post currently has no responses. What do you think?

You can use basic HTML when posting code, please turn all < characters into &lt; or > into &gt;
If the code is multi-line, use <pre><code></code></pre>

Leave a Reply

Your email address will not be published. Required fields are marked *