>>> It's the reason why developers ought to use ("mystring"==myvar) instead of 
>>> (myvar=="mystring").
> For what reason is this ?

It mitigates the following class of bugs (not the single = sign instead of ==):

if (myvar = "mystring") // will compile/run but behave incorrectly

if ("mystring" = myvar) // won't compile/run and you can fix it right away

Based on an earlier response in the thread, if this seems pedantic to
some readers, take into consideration that millions of programmers
will be writing billions of if statements each year which will yield a
thousand bugs at an error rate of 0.0001% or 1 in a million. The
cost-benefit of simply switching the order is clear.

-- Aleem

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to