Programming Code Center(PCC)
[JS]

(PCC)::[How-Single-line-comment-to-prevent-execution-in-JavaScript]::[js]

File Name : index.html

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Comments</h2>

<h1 id="myH"></h1>

<p id="myP"></p>

<script>
//document.getElementById("myH").innerHTML = "My First Page";
document.getElementById("myP").innerHTML = "My first paragraph.";
</script>

<p>The line starting with // is not executed.</p>

</body>
</html>

Output :

JavaScript Comments

The line starting with // is not executed.