How does false == (x > y) work?

javascript

Solution

It's just a more verbose way of writing

x <= y

The result of `x > y` is evaluated and compared to `false`. Since the result of `x > y` is boolean, that's the same as writing

!(x > y)  // an == true is implied here if you don't add it yourself

which of course is the same as writing

x <= y

Problem

I read this in a book and was just wondering how it works and if you would ever do something like that and for what reason you would do that. I understand you could return `(x>y)` but why would you do `false == (x > y)`?

Original source