当前位置:网站首页>What is the difference between JS undefined and null
What is the difference between JS undefined and null
2022-06-23 03:01:00 【It workers】
stay JavaScript in ,undefined Indicates that a variable has been declared but has not been assigned , for example :
var TestVar; alert(TestVar); // Show undefined alert(typeof TestVar); // Show undefined
null It's assignment . It can be assigned to variables as a representation of no value :
var TestVar = null; alert(TestVar); // Show null alert(typeof TestVar); // Show object
As can be seen from the previous example ,undefined and null There are two different types :undefined Is itself a type ( Undefined ), and null It's an object .
null === undefined // false null == undefined // true null === null // true
null = 'value' // ReferenceError undefined = 'value' // 'value'
边栏推荐
- Applet control version update best practices
- Markdown - mark above / below symbol (typora, latex)
- 2D visual empowerment smart water green intensive development
- What is sitelock? What is the function?
- Wi Fi 6 is coming - larger capacity, lower latency, faster network speed and more security
- Goframe framework (RK boot): rapid configuration of server CORS
- Zoom/skype/ nailing / live broadcast / conference / online video real-time subtitle generation and translation, simultaneous interpretation
- SAP mm initial transaction code MEK1 maintenance pb00 price
- Detailed explanation of various networking modes of video monitoring platform
- Blue screen and abnormal downtime DMP file and system log collection
猜你喜欢

Soft exam information system project manager_ Contract Law_ Copyright_ Implementation Regulations - Senior Information System Project Manager of soft exam 030

8. greed

6. template for integer and real number dichotomy
What is sitelock? What is the function?

5. concept of ruler method

Vulnhub DC-5

C language series - Section 4 - arrays

Soft exam information system project manager_ Information system comprehensive testing and management - Senior Information System Project Manager of soft test 027

How to store, manage and view family photos in an orderly manner?
随机推荐
How does the easyplayer streaming video player set up tiling?
Reading redis source code (V) master-slave replication and sentinel mechanism
Construction and exploration of vivo database and storage platform
How audio and video technology provides a completely true and stable new experience for the meta universe
How PHP uses redis
Learning about urldns chains
Markdown - mark above / below symbol (typora, latex)
5 trends brought to us by customers
C language series - Section 4 - arrays
A penetration of an internal self built shooting range
February 2, 2022: the closest binary search tree value II. Given a non empty two
Goframe framework (RK boot): fast implementation of CSRF verification
Build a weather forecast applet using a widget
[data preparation and Feature Engineering] perceived data
Redis source code reading (I) general overview
Troubleshooting and optimization of easynvr version 5.0 Video Square snapshot not displayed
Detailed explanation of various networking modes of video monitoring platform
Record a penetration caused by log4j
Related concepts of TTF, TOF, woff and woff2
Reinforcement learning series (III) -gym introduction and examples