> 1 === 1

true

> 1 === 1 === 1

false

I understand why this happens, but it’s still interesting.

Reply to this note

Please Login to reply.

Discussion

for real?

Yeah I know, using numbers (or any other non-boolean type) in a boolean context πŸ˜πŸ”«

That's why you use lints, that catch such things.

I don't understand why this happens, can you explain?

Is it that 1 === 1 === 1 is basically:

(1 === 1) === 1

true === 1

false

Meaning boolean is not a integer, or 1 casted to boolean is not "true"?

Yeap, 1 and true have different types. One is a number, the other is a boolean. But the `===` op is checking for the same type.

ASCII art evaluates to true|false?