Last active
January 5, 2017 01:29
-
-
Save ygkn/f8b1f314152061b0dcb41290ebf1eaad to your computer and use it in GitHub Desktop.
ES6でisNaN関数を作るととてもアレになる。 ref: http://qiita.com/ygkn/items/83cd41c9ee7f0c487b52
This file contains hidden or 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
| isNaN("x") // -> true | |
| Number.isNaN("x") // -> false |
This file contains hidden or 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
| myIsNaN =_=>_!==_ ; | |
| myIsNaN(NaN) // -> true |
This file contains hidden or 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
| myIsNaN = _ => _ !== _ ; |
This file contains hidden or 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
| myIsNaN = value => value !== value ; |
This file contains hidden or 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
| function myIsNaN(value){ | |
| return (value !== value); | |
| } |
This file contains hidden or 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
| myIsNaN =_=>({}).toString.call(_)!=="[object Number]"||_!==_ |
This file contains hidden or 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
| myIsNaN =_=>!(({}).toString.call(_)==="[object Number]"&&_===_) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment