javascript - Can (a== 1 && a ==2 && a==3) ever evaluate to true?

Published: 10 April 2024
on channel: Code Samples
2,358
43

Moderator note: Please resist the urge to edit the code or remove this notice. The pattern of whitespace may be part of the question and therefore should not be tampered with unnecessarily. If you are in the "whitespace is insignificant" camp, you should be able to accept the code as is.

Is it ever possible that (a== 1 && a ==2 && a==3) could evaluate to true in JavaScript?
This is an interview question asked by a major tech company. It happened two weeks back, but I'm still trying to find the answer. I know we never write such code in our day-to-day job, but I'm curious.
how == works: https://developer.mozilla.org/en-US/d...


Watch video javascript - Can (a== 1 && a ==2 && a==3) ever evaluate to true? online without registration, duration hours minute second in high quality. This video was added by user Code Samples 10 April 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,358 once and liked it 43 people.