current position:Home>JavaScript comments

JavaScript comments

2022-05-15 04:29:10The evening wind blows


Notes are used to explain JavaScript Code , Improve readability

One 、 Single-line comments

Single line comment with // start

<script> // Output html Content  document.write("<h1> first JavaScript</h1>"); </script>

Two 、 Multiline comment

Multiline comments to /* start , */ ending

<script> document.write("<h1> first JavaScript</h1>"); /* window.alert("warning: Please press OK "); document.getElementById("p").innerHTML= "i am a epic"; log = " Output and look at the log " console.log(log) */ </script>


1、 Comments improve code readability
2、 Shielding part code , Make it inoperative
3、 Comments are divided into single line comments // , Multiline comment /* */

copyright notice
author[The evening wind blows],Please bring the original link to reprint, thank you.

Random recommended