NaN being falsey leads to interesting statements
NaN
is a javascript constant representing something that is 'not a number', and like almost everything else in javascript, its falsey.
Boolean(NaN)
> false
You can determine if a number that is passed to a function is valid after you give it to a mathematical operation.
function doSomething(number) {
var importantNumber = number * 96 || 100;
console.log(importantNumber)
}
Tweet