# JS WTF: 5 \< 4 \< 3

DevFeed: [JS WTF: 5 \< 4 \< 3](<https://devfeed.tech/articles/js-wtf-5-4-3-52507.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/js-wtf/>)

Published: 2012-04-10T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [console](<https://devfeed.tech/topics/console.md>)

Tags: [console](<https://devfeed.tech/tags/console.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [js](<https://devfeed.tech/tags/js.md>), [operator](<https://devfeed.tech/tags/operator.md>), [wtf](<https://devfeed.tech/tags/wtf.md>)

## AI overview

JavaScript evaluates `5 < 4 < 3` from left to right as `(5 < 4) < 3`. The first comparison yields `false`, which is coerced to `0`; since `0 < 3`, the expression returns `true`.

## Source excerpt

A quick fun "JS WTF?" post for you today. If you load up your JavaScript console & enter: 5 < 4 < 3 You'd be expecting to see false, right? However, you'll actually see true. WTF? This is actually down to the way JavaScript evaluates this and operator precedence. What it sees is: (5 < 4) < 3 Which in turn gives false < 3 JavaScript then coerces false into an integer 0: 0 < 3 And zero is indeed less than 3, so we get true returned. Not much learned from this one but it's quite a fun thing to show someone & then explain why. I'll be trying to do a lot of these small "fun" posts as there's a fair few areas of "WTF?" in JavaScript, as we all know.