Comments

JavaScript uses C-style comments for both single-line and block comments.

A single-line comment begins with two forward-slash characters: //single line comment

 
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
  <script type="text/javascript">
      // var firseName = 'firseName';

  </script>
</head>
<body>
</body>
</html>
  
Click to view the demo

A block comment begins with a forward slash and asterisk (/*) and ends with the opposite (*/):


/* 
* This is a multi-line 
* Comment 
*/
 
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
  <script type="text/javascript">
     /* var firseName = 'firseName';
      var thisIsAnotherVariable = 'this Is Another Variable';
    document.writeln(firseName);
    document.writeln(thisIsAnotherVariable);
     */  
  </script>
</head>
<body>
</body>
</html>
  
Click to view the demo
Home 
  JavaScript Book 
    Language Basics  

Language Basics:
  1. Case-sensitivity
  2. Identifiers
  3. Comments
  4. Strict Mode
  5. Statements
  6. Keywords And Reserved Words
  7. Variables