When working with long, complex blocks of code, it's a good practice to leave comments that explain the function of the code.
This helps you remember the purpose of the code, and is especially useful if a third party will be working on the same script.
In this html file we have an example of both.
// This is a single line comment.
document.getElementById("h").innerHTML = "Test";
document.getElementById("p").innerHTML = "Paragraph";
This is an example
of a Multi-line comment.
We can insert as many lines
as we like.
This text will not be executed.
We can see the result in our web browser.
The word test is outputted using the innerHTML function.
We can see that the word "paragraph" is not outputted in our browser, despite using the innerHTML function.
If we remove the comment, the code will execute.
Lastly, we have an example of a multi-line comment. These are best used for explanations of large code blocks.
To create one, use the slash and asterisk combination.