Comments in JavaScript part 1

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>
Try It Yourself

Result:
It's a good idea to make a comment about the logic of large functions to make your code more readable for others.
How does the single line comment look like?
**this is a comment
// this is a comment
%%this is a comment
<!--this is a comment-->

Comments

Popular posts from this blog

Introducing object part 3

Comparison Operators part 2

Module 2