Today I Learned

hashrocket A Hashrocket project

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)
}
See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.