Ad Unit

how can you add a comment in a javascript

how can you add a comment in a javascript

The answer is :

In JavaScript, you put two slashes"//" in front of the code or text you want the JavaScript interpreter to ignore to make a single line statement.

These types of comments are great for commenting out single lines of code and writing small notes.

JavaScript Code:
<script type="text/javascript">
<!--
// This is a single line JavaScript comment

document.write("I have comments in my JavaScript code!");
//document.write("You can't see this!");
//-->
</script>

Related Posts

Post a Comment