当前位置:网站首页>What is the difference between the three values of null Nan undefined in JS
What is the difference between the three values of null Nan undefined in JS
2022-07-07 22:03:00 【Vayne's fat tiger】
We are JS You will definitely encounter unfamiliar faces in data types , such as NaN and undefined, about null We are Java I've been in contact with you for a long time , Then let's look at the relationship and difference between these three things through the code ?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>null NaN undefined What is the difference between these three values </title>
</head>
<body>
<script type="text/javascript">
// == Is the equivalence operator
alert(1 == true); // true
alert(1 === true); // false
// null NaN undefined Inconsistent data types .
alert(typeof null); // "object"
alert(typeof NaN); // "number"
alert(typeof undefined); // "undefined"
// null and undefined Can be equivalent to .
alert(null == NaN); // false
alert(null == undefined); // true
alert(undefined == NaN); // false
// stay JS There are two special operators
// ==( The equivalent operator : Only judge whether the values are equal )
// ===( The congruent operator : Both judge whether the values are equal , And judge whether the data types are equal )
alert(null === NaN); // false
alert(null === undefined); // false
alert(undefined === NaN); // false
</script>
</body>
</html>
边栏推荐
- Backup tidb cluster to persistent volume
- Jerry's key to initiate pairing [chapter]
- Navicat connect 2002 - can't connect to local MySQL server through socket '/var/lib/mysql/mysql Sock 'solve
- SQL injection error report injection function graphic explanation
- Two kinds of updates lost and Solutions
- Solve the problem of using uni app mediaerror mediaerror errorcode -5
- The little money made by the program ape is a P!
- Use camunda to do workflow design and reject operations
- Ant destination multiple selection
- SAR影像质量评估
猜你喜欢
Use camunda to do workflow design and reject operations
ByteDance senior engineer interview, easy to get started, fluent
Dry goods sharing | devaxpress v22.1 original help document download collection
It's worth seeing. Interview sites and interview skills
Paint basic graphics with custompaint
三元表达式、各生成式、匿名函数
Reinforcement learning - learning notes 9 | multi step TD target
Google SEO external chain backlinks research tool recommendation
[C language] advanced pointer --- do you really understand pointer?
operator
随机推荐
Demon daddy A1 speech listening initial challenge
Demon daddy C
L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?
如何实现横版游戏中角色的移动控制
Focusing on safety in 1995, Volvo will focus on safety in the field of intelligent driving and electrification in the future
Dry goods sharing | devaxpress v22.1 original help document download collection
Win11时间怎么显示星期几?Win11怎么显示今天周几?
Arlo's troubles
Nine degree 1201 - traversal of binary sort number - binary sort tree "suggestions collection"
Oracle advanced (VI) Oracle expdp/impdp details
Using enumeration to realize English to braille
Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
[colmap] sparse reconstruction is converted to mvsnet format input
PKPM 2020软件安装包下载及安装教程
Which financial products will yield high returns in 2022?
The little money made by the program ape is a P!
NVR hard disk video recorder is connected to easycvr through the national standard gb28181 protocol. What is the reason why the device channel information is not displayed?
Code of "digital image processing principle and Practice (matlab version)" part2[easy to understand]
【Azure微服务 Service Fabric 】如何转移Service Fabric集群中的种子节点(Seed Node)
Automatic classification of defective photovoltaic module cells in electronic images