# Code Commenting First the straightforward part: how do we place comments in our code? ## JavaScript Single line comments ```js // Change heading: document.getElementById("myH").innerHTML = "My First Page"; ``` Single line comments at end of the line: ```js const x = 5; // Declare x, give it the value of 5 ``` Coding **well** in JavaScript: [JSDoc](http://usejsdoc.org/) ## HTML [W3Schools](https://www.w3schools.com/html/html_comments.asp) Comments ```html ``` ## CSS [MDN on CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments) ```css /* Comment */ /* A comment which stretches over several lines */ ``` ## When to comment? Now for the hard part: when to comment? When you work for different companies, you will see different styles. Embrace something you like, and then learn to let go. Google on "when to comment code?" and you'll find a big bunch of different opinions. The general concept is, however, that it is there to help make the code more easy to understand. Note, however, that comments can also make code more difficult to understand when not applied properly.