3 ms·
Surprised to see people claiming that this isn't essential knowledge. Understanding what the system is doing at its core allows you to answer these questions; a
by nirvanatikku 14y ago
Surprised to see people claiming that this isn't essential knowledge. Understanding what the system is doing at its core allows you to answer these questions; as 'tricky' as they may seem. If you're dealing with JS, you should know how things are working under the hood. There shouldn't be any memorizing, instead, you should be able to reason what the outcome is in those cases. At least that's what I strive for.
- politician 14y agoAgreed, knowing how 1/x behaves for x in [null, 0, void 0] is helpful. Specifically, don't expect a "div by 0" error to be thrown. Instead, check for infinity. That's not something a C# developer would necessarily expect.
- svachalek 14y agoYes, unfortunately many languages have borrowed C's rather bizarre ideas about what's permissible. 1/0 should crash but it's perfectly okay for 0xffffffffu + 1 to give different answers depending on your architecture.
- nemetroid 14y agoDividing a float by zero yields infinity (or -infinity) in C# as well.