Comment in JavaScript

What you will learn here about comment in javascript

  • single line comment in javascript
  • multi line comment in javascript

single line comment in javascript

In javascript Single line comment is added by using // (double forward slash)

<script>

//This is comment
var num=20;

document.getElementById(‘demo’).innerHTML=num;

</script>

multi line comment in javascript

In javascript multi line comment is added by using /* */

<script>
/*multi line comment example
var num=20;
document.getElementById(‘demo’).innerHTML=num;
*/
</script>

You may also like...