Why is the value for undefined considered Finite in javascript while null is not?
This is a very basic question, which has thwarted my googlefoo (too much noise).
isFinite(undefined); // false
isFinite(null); // true
I do not understand as I would expect null and undefined to be handled in the same manner.
This is because
Number(null) === 0
.http://es5.github.io/#x9.3
isFinite
convert input usingNumber()
and:that is the reason undefined is false and null is true for isFinite.
If you try:
because undefined is NaN and on negating it it converted to 1 which is finite.