Comments in Javascript

A comment in Javascript code is a line that is not read/executed as part of the program.
Its only purpose is to be read by someone who is editing the code.
Comments are useful for :-

  • To let others understood what you are doing – Comments let other programmers understand what you were doing in each step ( if you work in a group ).
  • To remind yourself what you did – Most programmers have experienced coming back to other own work a year or too later and having to re-figure out what they did.

Example

<script type="text/javascript">
// This is a single line comment

/*
This is a multi-line comment block
*/

</script>
Spread the love

Related Post

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *