How to write JavaScript annotations?
Almost any programming language will have the need for annotations, especially when your code is getting more and more, or the system architecture is getting bigger and bigger, you don’t have to write comments, it will make people confused and at a loss. , In JavaScript , there is also the function of annotations, it is recommended to develop a good habit of writing annotations, especially when team work, according to the rules to write clear annotations on every important place, this is what every team engineer must do Basic Kung Fu.
JavaScript comments are written using double slashes followed by the comment text, as shown below
<script language=javascript><!-- JavaScript program // Annotation text --></script>
The red part is the comment! The comment text is only for programmers to read and use, and will not affect the operation of the program. In addition, there is another kind of annotation that can be used in a larger range, which is presented through the wording of /* annotation content*/, and the text enclosed in /* and */ will become annotations.
<!--
/*
JavaScript comment text
JavaScript comment text
*/
-->
</script>
In the above example, the red area is the range enclosed by /**/ and will be annotated. In this way, it is easy to annotate multiple lines of text at once.
Post a Comment
0 Comments