HOLLA TECH - LEARN

JavaScript Comments
 

Not all JavaScript statements are “executed”.
Code after a double slash //, or between /* and */, is treated as a comment.
Comments are ignored, and are not executed.

Single line comments use double slashes. 

<script>
   // This is a single line comment
   alert(“This is an alert box!”);
</script

 

Result: 

Holla Tech - Learn JavaScript

NOTE!
It’s a good idea to make a comment about the logic of large functions to make your code more readable for others.

Multiple-Line Comments
 

Everything you write between /*and */ will be considered as a multi-line comment.

Here is an example.

<script>
   /* This code
   creates an
   alert box */
   alert(“This is an alert box!”);
</script

 

NOTE!
Comments are used to describe and explain what the code is doing.

BACK NEXT

CLICK ON THE BUTTON BELOW TO GO TO THE JAVASCRIPT MAIN COURSE PAGE. 

JAVASCRIPT MAIN COURSE PAGE

 


© License: All Rights Reserved 


CONTACT HOLLA TECH – LEARN SUPPORT