JavaScript comments and whitespace
documenting the script
Here we will outline two handy concepts regarding documentation in JavaScript:
Comments
Comments allow us to place notes inside the code, without affecting how the program runs:
However, we do hope to write our JavaScript clearly enough so that we can avoid excessive commenting!
Whitespace
To a certain extent, whitespace does not affect the running of JavaScript past the first space, e.g.:
We cannot write the following, for example, and expect the code to behave in the same fashion as the above:
JavaScript allows us to do things like this:
However, let's stick with this as a good practice of readability:
We could still do more than one space like this:
...but why? Let's just stick to this kind of convention:
Last updated