Get the App
SLTechnology News&Howtos  ›  Development  › 

How to add comments to JavaScript

Shulou Source: shulou.com Published: 2022-06-01 13:35:55 10月03日 Update

This article will explain in detail how to add notes to JavaScript. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Comments are of great importance in project development. Reasonable code comments are beneficial to the later modification and maintenance of the project and facilitate colleagues to understand the functions performed by the code. Comments are not read when the browser is running. Today we will learn how to add comments to JavaScript.

Single-line comments: in JavaScript, single-line comments are represented by / / (double forward slashes). As follows:

/ / this is a single-line comment

Multiline comments: in JavaScript, multiline comments are included with / * and * /, that is, / * / (forward slash with an asterisk). As follows:

/ * this is a comment * /

Or as follows:

/ * * yisu-* learn programming anytime and anywhere * / this is the end of the article on "how to add comments to JavaScript". I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Comments articles code slashes more this is project multi-line good practical clear important anytime anywhere content features colleagues articles asterisks benefits browsers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Microsoft MariaDB OPPO Reno macOS