![](https://cdn-ak-scissors.b.st-hatena.com/image/square/80b19d727a817ab44a87d69bf0bec6ec6e1ef4a3/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--Zz7Pcy49--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3ATypeScript%2525E3%252581%2525A7%2525E3%252581%2525AFNumber.isNaN%252528%252529%2525E3%252582%252588%2525E3%252582%25258A%2525E3%252582%252582isNaN%252528%252529%2525E3%252581%2525AE%2525E6%252596%2525B9%2525E3%252581%25258C%2525E5%2525AE%252589%2525E5%252585%2525A8%2525E3%252581%25258B%2525E3%252582%252582%2525E3%252581%252597%2525E3%252582%25258C%2525E3%252581%2525AA%2525E3%252581%252584%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3Anekoya%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL3plbm4tdXNlci11cGxvYWQvYXZhdGFyLzk2ZmU4ZWVmN2UuanBlZw%3D%3D%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)
エントリーの編集
![loading...](https://b.st-hatena.com/bdefb8944296a0957e54cebcfefc25c4dcff9f5f/images/v4/public/common/loading@2x.gif)
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
記事へのコメント7件
- 注目コメント
- 新着コメント
![hase0510 hase0510](https://cdn.profile-image.st-hatena.com/users/hase0510/profile.png)
![strawberryhunter strawberryhunter](https://cdn.profile-image.st-hatena.com/users/strawberryhunter/profile.png)
![strawberryhunter strawberryhunter](https://cdn.profile-image.st-hatena.com/users/strawberryhunter/profile.png)
![hase0510 hase0510](https://cdn.profile-image.st-hatena.com/users/hase0510/profile.png)
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
![アプリのスクリーンショット](https://b.st-hatena.com/bdefb8944296a0957e54cebcfefc25c4dcff9f5f/images/v4/public/entry/app-screenshot.png)
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
TypeScriptではNumber.isNaN()よりもisNaN()の方が安全かもしれない
これまで「グローバルのisNaN()ではなくNumber.isNaN()を使え!」を教義に生きてきたのですが、揺らいで... これまで「グローバルのisNaN()ではなくNumber.isNaN()を使え!」を教義に生きてきたのですが、揺らいできました。 JavaScriptのisNaN()は引数を数値に変換した結果がNaNであるかを判定します。 一方のNumber.isNaN()はES6で提供された関数で、引数がNaN以外の時はtrueを返しません。 console.log(isNaN('hello')); // true console.log(Number.isNaN('hello')); // false Number.isNaN()はより厳密な比較であり、キャストを行わないため余計な混乱を避けられるものとして提供されました。 文字列などを渡した場合はtrueを返さないため、Number.isNaN()に渡す時点であらかじめ数値に変換しておくなど型を意識した操作がアプリケーション側の責務として求められるよ
2023/08/02 リンク