Creating Javascript Comments
<p>We'll get you familiar with some syntax first. In JavaScript you can comment a single line by putting two forward slashes in the start of that line like this:</p> <p>// one line comment</p> <p>Or if you have a lot more to say (multiple lines in a comment,) you can achieve that with ease by putting “/*” at the start and “*/” at the end like this:</p> <p><i>/* This function requires two parameters: a string and a boolean.</i></p> <p><i>It then returns a boolean that indicates if the user has a fat butt or not.</i></p> <p><i>Call it like this for example: gotFatButt(userName, isFat); */</i></p> <h3>How can Comments help us?</h3> <p>Comments can be used to achieve discipline in coding. First you can comment out any code which you don’t want to run. If you delete your code there's always a chance you’ll regret it later when suddenly you figure out it's just what you need. Instead of deleting, just comment out blocks of code you think you might need again. (It's almost guaranteed that if you delete a block, you WILL need it later!) </p> <p>Comments are a great way to describe your code and leave behind extra information for you and others that work with your code. A good program needs a good strategy and many times a few comments can help and improve overall understanding of your code. Comments are used as documentation many times in code as a way to share with others and yourself insight about your code. Many times we comment out debugging functions or other lines of code that we still want available but don't want them to run.</p> <p>These tips may make your life easier in the future.</p>