Hacker News new | ask | show | jobs
by nothrabannosir 2989 days ago
Minor note:

> A = { n^2 : n = 1, 2, …, 100 }

> In Python, or interpreting the expression literally, the value of n would be a tuple, producing a type error. (In Javascript, it produces 2.[link] How could it be Javascript if it didn’t?)

That linked JS code uses ^, which is xor, not pow. Math.pow([], 2) = NaN. Or maybe that was the joke and it flew completely over my head.

1 comments

I suspect that's the joke. Making fun of how Javascript parses or evaluates expressions is a favorite passtime in programmer circles.

See, for example, https://www.destroyallsoftware.com/talks/wat