Languages
Post #7420, on Nov 15, 2025 in TG
Cat Furious That JavaScript String Comparison Makes Dog Greater Than Cat
Description
A meme with bold white text at the top reading 'HE IS MAD THAT "DOG" > "CAT" IS TRUE IN JAVASCRIPT'. Below is a code snippet showing 'console.log("Dog" > "Cat") //true'. The main image shows an angry-looking Scottish Fold cat sitting on a tiled floor next to an orange appliance, with a human hand reaching toward it offering a treat and the cat aggressively grabbing at it with a disgruntled expression. The cat's anger perfectly represents the frustration with JavaScript's lexicographic string comparison, where 'Dog' > 'Cat' evaluates to true because 'D' has a higher Unicode code point than 'C'. The imgflip watermark is visible in the bottom right
Use J and K for navigation
Comments
11Comment deleted
In JavaScript, dogs are greater than cats. In TypeScript, the compiler would've stopped you from comparing pets in the first place
Of course 'Dog' > 'Cat'. It's lexicographical order. The cat's not mad about that. It's mad because ('b' + 'a' + + 'a' + 'a').toLowerCase() is 'banana'
okay but why are we talking shit about JS when the exact same thing happens literally everywhere else Comment deleted
well okay not everywhere Comment deleted
50% of the time it works all the time. Just don't update your binary Comment deleted
It compares the pointers and it so happends that "Dog" is stored earlier in the executable than "Cat" ? Maybe try running with others optimization levels Comment deleted
Actually the C standard made it UB to compare cats and dog that way3 Comment deleted
Additionaly, even in a tiny program, the compiler uses its normal constant-pool layout rules, so literals aren’t stored in source order Comment deleted
Idk why but I love this cat sooo much Comment deleted
But in a shell, cat > dog is valid while dog > cat is not Comment deleted
Be gone spambot! @linegel Comment deleted