3 ms·
"While often derided as a toy" Javascript is not a toy; toys are fun.
by PhineasRex 11y ago
"While often derided as a toy"
Javascript is not a toy; toys are fun.
- serve_yay 11y agoWhat could be more fun than a language that says the result of dividing by 0 is "Infinity"? It's a hoot!!
- ahoge 11y agoThat's from IEEE 754 (a standard for floating-point arithmetic). `NaN` and -0 exist for the same reason.
- bionsuba 11y agoTo be fair, just because something is a standard doesn't mean it isn't a dumb implementation. Just by testing the programming languages on my computer, I can tell you that Python, C, and D all throw errors rather than allow it, which is the smart thing to do.
- magicalist 11y ago> I can tell you that Python, C, and D all throw errors rather than allow it Python throws an error, but numpy.divide(1., 0) will work just fine (and return inf). I'm not sure why you're saying C throws an error. The behavior of dividing by 0 is undefined by default, but on most machines these days the hardware implements IEE-754 and the C implementation will advertise as implementing IEC 60559, so 1. / 0 will give you inf as well.
- deleted 11y ago[deleted]
- serve_yay 11y agoI know, I was just joshing! Man, you guys really didn't like that one. Personally I enjoy taking a moment now and then to reflect on some of the sillier aspects of JS. This is because I love JS, not because I hate it.
- yarrel 11y agoI like JavaScript but that did make me laugh.