当前位置:网站首页>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>
边栏推荐
- [开源] .Net ORM 访问 Firebird 数据库
- SAR影像质量评估
- 2022 how to evaluate and select low code development platforms?
- [open source] Net ORM accessing Firebird database
- OpenGL super classic learning notes (1) the first triangle "suggestions collection"
- Win11游戏模式怎么开启?Win11开启游戏模式的方法
- Embedded development: how to choose the right RTOS for the project?
- Jerry's test box configuration channel [chapter]
- #DAYU200体验官#MPPT光伏发电项目 DAYU200、Hi3861、华为云IotDA
- Which financial products will yield high returns in 2022?
猜你喜欢
Usage of MySQL subquery keywords (exists)
Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cyclic functions [chapter]
Reinforcement learning - learning notes 9 | multi step TD target
Crawler (17) - Interview (2) | crawler interview question bank
ISO 26262 - considerations other than requirements based testing
Debugging and handling the problem of jamming for about 30s during SSH login
[开源] .Net ORM 访问 Firebird 数据库
It's worth seeing. Interview sites and interview skills
Paint basic graphics with custompaint
Implementation method of data platform landing
随机推荐
MIT6.S081-Lab9 FS [2021Fall]
How to make agile digital transformation strategy for manufacturing enterprises
Ternary expressions, generative expressions, anonymous functions
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
嵌入式开发:如何为项目选择合适的RTOS?
How to turn on win11 game mode? How to turn on game mode in win11
Reinforcement learning - learning notes 9 | multi step TD target
Can I open a stock account directly online now? Is it safe?
Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?
Open source OA development platform: contract management user manual
Dry goods sharing | devaxpress v22.1 original help document download collection
Debugging and handling the problem of jamming for about 30s during SSH login
ByteDance Android interview, summary of knowledge points + analysis of interview questions
How polardb-x does distributed database hotspot analysis
[JDBC Part 1] overview, get connection, CRUD
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function
Demon daddy A1 speech listening initial challenge
PDF文档签名指南
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?