Drag the edges to resize the window.

Code Editor
Introduction to JavaScript


As we write JavaScript, we can create comments in our code.

Comments are lines that are not evaluated when the code runs. They exist just for human readers, in other words. Comments can be extremely useful when we're looking back at code we've written later on and for other people who will be looking at your code.

There are two types of code comments in JavaScript:

  1. A single line comment will comment out a single line, and is denoted with two forward slashes // preceding a line of JavaScript code.

    // The first 5 decimals of pi console.log('Pi is equal to ' + 3.14159);
  2. A multi-line comment will comment out multiple lines, and is denoted with /* to begin the comment, and */ to end the comment.

    /* console.log('All of this code'); console.log('Is commented out'); console.log('And will not be executed); */
Report a Bug
If you see a bug or any other issue with this page, please report it here.