console.log(`${window === this} (window === this)`)
console.log(`${window === self} (window === self)`)
console.log(`${this === self} (this === self)`)
console.log(`${window === this === self} (window === this === self)`)
Why is window === self === this
false in JavaScript
Because you can't chain equality operators in such a way in javascript.
window === this === self
is actually the same as: (window === this) === self
where the parentheses is evaluated first. In other words window === this === self
equals true === self
which evaluates to false
.