The actual difference between Javascript's
==
and
===
operators is that the
==
operator is less strict when comparing the operands. For example,
1=="1"
evaluates to
true
while
1==="1"
evaluates to
false
.
Full description can be found on ECMAScript standard, at
http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf, on chapter
11.9.
A practical tip to quickly understand "what would
==
do" is to illustrate what will happen when you call
.toString()
on both operands. Thinking that way, it will make sense that
1.toString()=="1"
. This is
not the precise algorithm for
==
, but it does provide a good approximation, useful for daily work.
Currently a .NET Team Leader at a mid-sized software company, I've started coding at the age of 5, using BASIC on a ZX-Spectrum 48 computer.
Gradually i've moved up the generations, from ZX assembly language, through c and Pascal, I've became an IS programmer on VB6 and SQL-Server, eventually upscaling to c#, and doing OOD stuff for a living.
I'm about to get my Bachelor's degree in Computer Science this semester, and looking forward to go on with M.Sc. in the area of Algorithmics.
So I work in Information Systems, and my hobby is "learning and developing algorithms". Can you get more geeky than that ?