Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Can a === 1 && a === 2 && a === 3 be true in JavaScript?

Lots of you may be aware that there is famous interview question which asks whether a == 1 && a == 2 && a == 3 can be true in JavaScript. And the answer to this question is YES. The reason is that == will do a non-strict comparison which will evaluate a to a number and this provides the possibility of dynamically return the value when every time a is accessed.Have you ever wondered whether a === 1 && a === 2 && a === 3 can be true? At first glance, it seems this is impossible since === will do strict comparison and the type of the two sides must be the same befo...

5,264 2       JAVASCRIPT === STRICT COMPARISON