Possible Duplicate:
What is the difference between these (bCondition == NULL) and (NULL==bCondition)?
Javascript minification of comparison statements
Ive been writing my if
statements like this:
if(variable1 === 1){}
if(variable2 > 10){}
if(variable3 == "a"){}
But I remember reading somewhere (unfortunately I cant find that page anymore), that if
statements are better off written like this:
if(1 === variable1){}
if(10 < variable2){}
if("a" == variable3){}
Where you put the variable on the right hand side of the expression.
Is this correct? And, if so, can anyone shed any light on why this is correct? Also, does this apply to all programming languages, or just javascript?
TIA