JavaScript Comments

 JavaScript Comments

  • JavaScript comments are hints that a programmer can add to make their code easier to read and understand. 
  • They are completely ignored by JavaScript engines.

There are two ways to add comments to code:

  • // - Single Line Comments
  • /* */ -Multi-line Comments

Single Line Comments

  • In JavaScript, any line that starts with // is a single-line comment.


    let firstName = "ram";

    // printing name on the console
    console.log("Hello " + firstName);

Multi-line Comments

  • In Javascript, any text between /* and */ is a multi-line comment


    /* The following program contains the source code for
    For the they cannot move. The player controlling the his disposal.
    */

0 Comments:

Post a Comment

Do leave your comments