News for hackers. Stuff that matters.
Re:JavaScript: The Curious Case of null >= 0 by exo128 on Monday September 11, 2017 @08:50PM (#15223877)
It took me a bit to dig through the fringe cases to find the combination (or maybe an additional combination?) to pull that off.

x = ''

y = '-Infinity'

z = -1

x < y // true: '-Infinity' (y) doesn't get coerced into a number, so '' < 'any string with at least 1 character'

y < z // true: '-Infinity' (y) compares with a number, so it coerces to -Infinity, which is less than -1 (z)

z < x // true: '' (x) is compared with a number, so it coerces to 0, which is greater than -1 (z)

Thank you for the brain exercise!

P.S. - No one ever use crap like this in production code!

Re:JavaScript: The Curious Case of null &gt;= 0 by justinpombrio on Thursday September 14, 2017 @11:46PM (#15254474)
Oh interesting. The triple I found used the same general idea of values that sometimes coerce to a number, but it made use of octal values instead of Infinity.