3 ms·
Hmm null is easier to pass on purpose and undefined is easier to pass by accident. Sending in undefined for a non-trailing argument takes effort. I think the
by willvarfar 13y ago
Hmm null is easier to pass on purpose and undefined is easier to pass by accident.
Sending in undefined for a non-trailing argument takes effort.
I think the literal null is far more communicative of the developers intent.
But the general point is, JS APIs tend to fail silently on error by design and that's something that bugs me, literally. Bugs. Lots of them.
I agree regards returning a failure rather than throwing an exception, though.