DEV Community

Discussion on: Can (aᅠ == 1 && a == 2 && ᅠa == 3) equal true?

Collapse
 
ailrun profile image
Junyoung Clare Jang

Yes, you also can make true from a === 1 && a === 2 && a === 3 without invisible character, since, we have getter.

let i = 0;
Object.defineProperty(window, 'a', {
  get: function() {
    return ++i;
  }
});
console.log(a === 1 && a === 2 && a === 3);
Collapse
 
pichardoj profile image
J. Pichardo

Precisely, nice catch.