Skip to content

Instantly share code, notes, and snippets.

@AaronFlower
Created January 15, 2019 03:07
Show Gist options
  • Save AaronFlower/92dac6da553288e4fa9dcd2fc13d719b to your computer and use it in GitHub Desktop.
Save AaronFlower/92dac6da553288e4fa9dcd2fc13d719b to your computer and use it in GitHub Desktop.
In Javascript, to check whether a value is not a number.
/*
* In ES6, You can use Number.isNaN to check whether a number is not a number. Or in ES5, you should use a polyfill
* condition to check, `n !== n`
*/
Number.isNaN = Number.isNaN || function(value) {
return value !== value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment