10. Commenting Your Code

In This Chapter

Learn the importance of code comments

Familiarize yourself with the JavaScript syntax for writing comments

Understand good commenting practices

We are almost done with our break. Just one more topic left, and it is a good one! See, here is the thing—everything you write in your code editor might seem like it is intended for your browser’s eyes only:

var xPos = -500;function boringComputerStuff() {  xPos += 5;  if (xPos > 1000) {    xPos = -500;  }  requestAnimationFrame(boringComputerStuff);}

As you will soon find out, that isn’t the case. There is another audience for your code. That audience is made up of human beings.

Your code is often used or scrutinized by other ...

Get JavaScript Absolute Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.