Comments refer to lines or blocks of inexecutable expressions or explanation about some certain piece of code.
There are so many reasons to comment your code but below is the basic reason:
It explains the part of the code that may be difficult for fellow developers to understand or for the owner of the codebase to remember its uses after leaving the codebase for a while.
//call function tick every second.
Or you can put the comment by the side of the code like below:
let name; // declares name
name = "Ayobami"; //the value of name is set to Ayobami
This takes us to multi-line comments.
What are multi-line comments?
Multi-line comments are written between a star-forward slash and a star-forward slash as in below:
/* Get the element with its id and
set its content to 5 */
const element = document.getElementById("id");
element.innerHTML = 5;
Viola! We are done with commenting.
See you in the next lesson!
Don't trust me, get a free previous to judge by yourself: https://bit.ly/3o3TMyg