Write HTML tags in JavaScript

JavaScript Single line comments can be used to make the code more readable.

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <title>JS Single-line Comments</title>
</head>
<body>
<pre>
<script type="text/javascript">

        // Write on browser
        document.write("Hello World!");
         
        // Write text an <h2> Heading
        document.write("<h2> Hello World! </h2>");

        document.write("Hello World!");  // Write Comments at end of a Line

        // Execute JS Code that are write in comment line
        //document.write("<h2>This text is h2 Heading</h2>");

</script>
</pre>
</body>
</html>

Run it...   »

Example Result