current position:Home>JavaScript comments

JavaScript comments

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

Preface

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

<body>
<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>
</body>

summary

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.
https://en.qdmana.com/2022/135/202205142149359690.html

Random recommended