Ending statements with semicolon is not required, but highly recommended.
var a, b, c; // Declare 3 variables
a = 5; // Assign the value 5 to a
b = 6; // Assign the value 6 to b
c = a + b; // Assign the sum of a and b to c
When separated by semicolons, multiple statements on one line are allowed:
a = 5; b = 6; document.write("<h1>Hello World</h1>") ;
Single Line Comments –
Single line comments start with //.
In the example below, the first line – “Hello World 1” will not be executed.
//document.write("<h1>Hello World 1</h1>")
document.write("<h1>Hello World 2</h1>")
Multi-line Comments –
Multi-line comments start with /* and end with */.
In the example below, both the lines will not be executed.
Using comments whenever necessary is always a good practice and in real world scenarios it is many times necessary.