Created
January 15, 2019 03:07
-
-
Save AaronFlower/92dac6da553288e4fa9dcd2fc13d719b to your computer and use it in GitHub Desktop.
In Javascript, to check whether a value is not a number.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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