Consider the following example
< img src="plus.gif" alt="Increment x" onclick="x=x+1">
< img src="plus.gif" alt="Increment x" onclick="X=X+1">
both not equivalentbecause first modifies the variable "x" where as second modifies the variable"X".Because java script is case-sensitiv.
The onclick HTML attribute is not case-sensitive and so may be written onClick, ONCLICK, or even oNcLiCk. However, because the value to which it is set contains JavaScript, its value is case-sensitive.
White Space:
Any sequence of excessive whitespace characters is ignored by JavaScript.
Consider the following:
s = typeof x;
s = typeofx;
The first statement invokes the typeof operator on a variable x and places the result in s. The second copies the value of a variable called typeofx into s. One space changes the entire meaning of the statement.
Statements :
consider this example:
x = y + 1 ;
This will add y with 1 & value is stored in x
semicolons indicates the end of the javascript statement,So we can write multiple satements in one line like this
x = x + 1; y = y + 1;z = z + 1;
Although statements are generally followed by semicolons, they can be omitted if your statements are separated by a line break
x = x + 1
y = y - 1
is treated as
x = x + 1;
y = y - 1;
But while writing return we have to be care full...if we write it like this ...
return
x
then it will be treated as
return;
x;
insted we should write it like this
return x;