1. A semicolon at the end of every statement (is Optional)
;) which indicates termination of the statement.
However, it is not necessary to use a semicolon(
;) at the end of the statement.
var var_name = value;
var var_name = value
var i = 10;
var j = 20;
var a = i+j; var b = i-j;
Let's take an example, in the code below, all the three variables are distinct from each other because the first one is in the lower case, the second one starts with a capital letter, and the third one is in the upper case.
In camel-case style, all alphabets are in small expect for the starting alphabet of words, and the first alphabet will always be small. So if I want to name a variable or a function as myfirstvariable, the camel case style would be myFirstVariable.
Comments refer to the text or code in a program that is ignored at the time of executing the program. Comments are used to provide additional information in the code, such as the description of code. And it is considered as good practice to add comments to your code.
Single line Comments
// This is an single line comment and it will not be executed
This is a multiline comment and everything written
inside this block will not be executed.
var x = 10;
var y = 2*x;
<!-- Some HTML code - This is HTML comment -->
Statements are known as the instructions in any programing language, these statements are set to be executed by the computer as a computer program.
var a = 10+20; // Another Statement