JavaScript tutorial-comments

JavaScript comments

Like other languages, comments are used to explain the code written. The signs used for comments in JavaScript the same as that of C, C++, C#, and Java. There are two types of comment that you can use. They are single-line comment and multiple-line comments.

-The // sign is used to make comments for a single line. You can place only a single of text or code after the single-line comment.

-The /*      */ is used to make comments for multiple lines. You can use the multiple-line comment for expadning lines of text or code.

You should note that any code in the comments are not compiled or translated.


/* This code teaches you how to write a program that will print out the words Hello World in JavaScript */
function Hello()
// The Hello function
   document.write(“Hello World”);


This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.