xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to add a single-line comment in JavaScript
JavaScript Online Editor
Run Code
More JavaScript Sample Codes
<!DOCTYPE html> <html> <head> </head> <body> <h1 id="myHeader"></h1> <p id="myParagraph"></p> <!--Script tag is added to write JavaScript code inside it--> <script> // This is a single comment document.getElementById("myHeader").innerHTML = "How to add a single-line comment in JavaScript"; // This is another single line comment document.getElementById("myParagraph").innerHTML = "Add two forward slashes (//) at the beginning of the line. Anything after // on a line is considered as a comment and is ignored by the JavaScript interpreter."; </script> </body> </html>