Javascript - Comments


We are using comments to make Javascript more readable and comments are not executed by JavaScript. That can be used to explain the coding. In JavaScript, there are two types of comments can be used,
01. Single Line Comments
      Single Line Comments begins with 02 forward slashes and there is no ending, its 
      applicable to the whole line which it puts.
      Syntax:
      // <Comment>

      Ex:
      // This is a single line Comment
      var no = 0; // This is Number type variable

02. Multi Line Comments
      Multi Line Comments begins with a /* and ends with */. 
      Syntax:
      /* <Comment> */

      Ex:
      /* This is a Multi line Comment
          Purpose of this comment is explain 
          the code with more than one line */

No comments:

Post a Comment