- Single line comment
- Multi-line comment
Single line Comment
It starts with // and ends with the end of that line. Anything after // to the end of the line is a single line comment and will be ignored by the compiler.
var txt; // first line comment txt = "Hello World!"; // second line comment
The output (value of txt) after running above script will be:
It starts with /* and ends with */. Anything between /* and */ is a block comment and will be ignored by compiler.
/*block comment.*/ statements; /*block comment.*/ statements;
/*first block comment. */ var txt; txt = /* second block comment */ "Hello World!";
The output of the above code will be: