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

Example without getters or valueOf:

_x000D_
_x000D_
a = [1,2,3];_x000D_
a.join = a.shift;_x000D_
console.log(a == 1 && a == 2 && a == 3);
_x000D_
_x000D_
_x000D_

This works because == invokes toString which calls .join for Arrays.

Another solution, using Symbol.toPrimitive which is an ES6 equivalent of toString/valueOf:

_x000D_
_x000D_
let i = 0;_x000D_
let a = { [Symbol.toPrimitive]: () => ++i };_x000D_
_x000D_
console.log(a == 1 && a == 2 && a == 3);
_x000D_
_x000D_
_x000D_