当前位置:网站首页>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'
边栏推荐
- How to batch print serial and repeated barcode data
- Goframe framework (RK boot): rapid configuration of server CORS
- How to set jewelry label paper
- The difference between script in head and body
- How to make traditional Chinese medicine labels with pictures
- Markdown - enter a score (typora, latex)
- JS judge the mobile terminal and PC terminal
- Direct collection - super easy to use domestic color matching website
- "Return index" of live broadcast E-commerce
- Soft exam information system project manager_ Contract Law_ Copyright_ Implementation Regulations - Senior Information System Project Manager of soft exam 030
猜你喜欢

C language series - Section 4 - arrays

Vulnhub DC-5

6. template for integer and real number dichotomy

How to store, manage and view family photos in an orderly manner?

5. concept of ruler method
What is sitelock? What is the function?

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

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

8. greed
随机推荐
No error is reported when using the Gorm framework to create a table, but the data cannot be inserted successfully
Add other view components to the audio and video components of the applet
How audio and video technology provides a completely true and stable new experience for the meta universe
PNAs: power spectrum shows obvious bold resting state time process in white matter
Account protection and use scheme
Goframe framework (RK boot): fast implementation of CSRF verification
How to use fortress on mobile devices
A bit about the state machine (FSM SMR DFSM)
Direct collection - super easy to use domestic color matching website
Detailed explanation of online reputation management
Why do I use index, query or slow?
How PHP uses redis
Capture passwords of all chrome versions
Build a weather forecast applet using a widget
Biological psychiatry: defining individualized functional neuroanatomy for precision psychiatry
Soft exam information system project manager_ Information system comprehensive testing and management - Senior Information System Project Manager of soft test 027
Gorilla/mux framework (RK boot): add swagger UI
2022 opening H5 mobile page special effects
Line to line interviewer | one side of ByteDance
Apache Druid's engineering practice in shopee