Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Single-line JavaScript Comments</title> </head> <body> <h2 id="myHeading"></h2> <p id="myParagraph"></p> <script> // For heading document.getElementById("myHeading").innerHTML = "Single-line JavaScript Comments"; // For paragraph document.getElementById("myParagraph").innerHTML = "I have comments in my JavaScript code!"; </script> </body> </html>