Students Empire

Learn Something New
Home

Javascript Comments


Javascript uses C-style comments for both single-line and block comments.

A single-line comment begins with two forward-slash characters, such as this:

                //single line comment 
                

A block comment begins with a forward slash and asterisk (/*) and ends with the opposite (*/), as in this example:

                /*
                * This is a multi-line 
                * Comment 
                */
                
                <!DOCTYPE HTML>
                <html>
                <body>
                  <script type="text/javascript">
                      //this is a comment
                    document.writeln("This is a statement");
                    document.writeln("This is also a statement");
                    /* more comments
                       more comments
                       more comments
                       more comments
                    */
                  </script>
                </body>
                </html>