3 ms·
I don't know if that was the real intent of this code, considering all the weird nuance around NaN in Javascript - however I agree with the point the author mak
by rco8786 3y ago
I don't know if that was the real intent of this code, considering all the weird nuance around NaN in Javascript - however I agree with the point the author makes, and will take it one step further:
We should be building these semantics directly into our languages, not relying on programmers to strictly follow a "best practice". In this case, it would be making values non-nullable and baking in Result/Option/etc style types that force programmers into handling the null (or NaN) case.