博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Javascript] Identify and Deal with NaN in JavaScript
阅读量:4698 次
发布时间:2019-06-09

本文共 402 字,大约阅读时间需要 1 分钟。

Dealing with the special NaN value can be tricky in JavaScript. It behaves like a number and not a number at the same time. This lesson explains how to identify it using the isNaN function or the Number.isNaN method.

 

Number.isNaN = Number.isNaN  || function(x) {x !== x}

 

Number.isNaN(NaN) // trueNumber.isNaN("JS") // falseNumber.isNaN("") // false

 

转载于:https://www.cnblogs.com/Answer1215/p/6369006.html

你可能感兴趣的文章
【JBPM4】判断节点decision 方法3 handler
查看>>
filter 过滤器(监听)
查看>>
node启动时, listen EADDRINUSE 报错;
查看>>
杭电3466————DP之01背包(对状态转移方程的更新理解)
查看>>
kafka中的消费组
查看>>
python--注释
查看>>
SQL case when else
查看>>
SYS_CONTEXT 详细用法
查看>>
Pycharm配置autopep8让Python代码更符合pep8规范
查看>>
我的第一篇博客
查看>>
【C++算法与数据结构学习笔记------单链表实现多项式】
查看>>
C#垃圾回收机制
查看>>
31、任务三十一——表单联动
查看>>
python之hasattr、getattr和setattr函数
查看>>
maven使用阿里镜像配置文件
查看>>
Copy code from eclipse to word, save syntax.
查看>>
arguments.callee的作用及替换方案
查看>>
P2709 小B的询问
查看>>
PHP echo 和 print 语句
查看>>
第一讲 一个简单的Qt程序分析
查看>>