Before we get into commenting, I want to warn you about the slowly ending war of browser support for JavaScript. Back in the day, writing in JavaScript was a battle. You would have to write a ton of different statements for each different type of browser. Luckily, browsers are starting to get on the same page, and JavaScript is supported by all modern browsers. Update: Several years after writing this article, I must confess the entire world of JavaScript has changed. The assumption in the programming world is that a user will have JavaScript enabled if they intend to run any popular website. So, please code away in JavaScript.
JavaScript has a number of ways to comment
The JavaScript comment above allows everything between the opening /* and the closing */ to be commented.
The // comment only comments out everything after it that is still on the same line. The first line of our code is all commented out because the // was at the beginning. However, on the third line, notice that the // is after the document.write method, and that the method is not in the comment.
Stewart, Suzy. "Comments". After Hours Programming. Accessed on December 10, 2024. https://www.afterhoursprogramming.com/tutorial/javascript/comments-js/.
this article is very good