Cloud Training (Online)




JavaScript Tutorial #3 – Comments in JavaScript

JavaScript has the support for both single line and multi line comments like C++ or C#.

The single line comment is usually represented by // and the text between // and the end of the line is treated as comment.

The multiline comment is represented by the characters /* and */ and the text between them is a comment and can span across multiple lines.

Below is an example of the JavaScript code with the comments.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Ginktage.com Home Page</title>
    <script language="javascript" type="text/javascript">
        document.write('Welcome to Ginktage.com JavaScript Tutorial');
        // This is single line comment
        /* This is a multi line comment 1
        This is a multi line comment 2
        */
    </script>
</head>
<body>
</body>
</html>

image

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.