Javascript assigns every variable a type which changes as we assign different values to the variable. We can get the type of a variable using the 'typeof' operator.
For eg.,
var year = 2008;
alert(typeof hello );
alert(typeof year );
The above lines will output the type of the first variable 'hello' as String and the second variable 'year' as Number.
The types of Javascript variables are Boolean, Function, Number, Object and String.
A variable with no explicitly assigned value has a value 'undefined'.
'===' Operator
The === Operator (with three equals signs), always returns 'false ' if two operands are of different types and performs the operation of '==' operator if they are of same type. So the '===' is used to strictly compare two operands that are of same type.
var b = "123"; //String
alert( a == b );
alert( a === b );
the first output returns true as it just compares the value and ignores the tpe of the variables, whereas the second expression outputs 'false' as the two variables are of different types.
for-in
Javascript has a for similar to the one found in other programming languages. It also has a variant of the 'for' that can be used to iterate over the properties of an object or to iterate over arrays.
for ( var color in rainbow )
alert(colors[color]);

