Comments

In programming, often more than one person works on a project. You can probably imagine that the code worked on by hundreds of people can be chaotic. For this reason, comments are present in the vast majority of programming languages.

Comments mark a part of the program that will be ignored by the computer.

In JavaScript, we have two ways to create comments:

  1. The first way creates a single-line comment. Such a comment is created using two slashes //. The content of the line after the two slashes will be ignored by the computer. This means we can use such lines to communicate with other developers. For example:
  2. // The following line will print the result of 2 * 20
    console.log(2 * 20);
  3. The second way creates multi-line comments. Such comments are started with /* and ended with */. For example:
  4. /* 
    Author: Tim Novak
    Date: 8. 3. 2024
    */
    
    console.log(2 * 20);

Instructions

Insert any comment into the code.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

4/10

Comments | Start Coder