当前位置:网站首页>The difference between null and undefined
The difference between null and undefined
2022-04-23 07:34:00 【XIX (procrastination)】
null and undefined The difference between
null: Represents an empty object
undefined: Represents that the variable is not assigned
summary :
- When a variable is defined but no value is assigned , Output undefined
- The variable can be specified as null, But not assigned to undefined
- When the variable is set to null when , The type is object
Example :
️: When a variable is defined but not assigned a value , Output undefined.
var a;
console.log(a)
output:undefined
If you don't create a variable, use it , Output a is not defined
console.log(a)
output:Uncaught ReferenceError: a is not defined;
️: When assigning a value to a variable :
It can be assigned to null,
But it cannot be assigned to undefined
var a = undefind;
console.log(a)
output:undefind is not defined
var a = null;
console.log(a)
output:null
When the variable is set to null when , The type is object
var a = null;
console.log(typeof a)
output:object
版权声明
本文为[XIX (procrastination)]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230618085425.html
边栏推荐
- Urban emergency management - urban emergency communication command and dispatching system
- 不需要破解markdown编辑工具Typora
- 海南凤凰机场智能通信解决方案
- 可视化常见绘图(一)堆叠图
- PyTorch 18. torch. backends. cudnn
- Statement of American photography technology suing Tianmu media for using volcanic engine infringement code
- 连接orcale
- “泉”力以赴·同“州”共济|北峰人一直在行动
- 什么是闭包?
- go语言映射操作
猜你喜欢
带低压报警的51单片机太阳能充电宝设计与制作(完整代码资料)
How does the public and Private Integrated walkie talkie realize cooperative work under multi-mode communication?
江宁医院DMR系统解决方案
Urban emergency management - urban emergency communication command and dispatching system
记录阿里云服务器挖矿程序处理
hql求一个范围内最大值
pytorch:关于GradReverseLayer实现的一个坑
Typora语法详解(一)
关于短视频平台框架搭建与技术选型探讨
The people of Beifeng have been taking action
随机推荐
浅谈BFC(块格式化上下文)
Proteus 8.10安装问题(亲测稳定不闪退!)
如何将进程绑定到指定的CPU上
Solution of self Networking Wireless Communication intercom system in Beifeng oil and gas field
使用el-popconfirm和el-backtop不生效
自组网灵活补盲|北峰油气田勘测解决方案
Machine vision series (02) -- tensorflow2 3 + win10 + GPU installation
可视化常见绘图(五)散点图
美摄助力百度“度咔剪辑”,让知识创作更容易
Tensorflow安装后ImportError: DLL load failed: 找不到指定的模块,且国内安装缓慢
pytorch:关于GradReverseLayer实现的一个坑
项目文件“ ”已被重命名或已不在解决方案中、未能找到与解决方案关联的源代码管理提供程序——两个工程问题
Meishe helps Baidu "Duka editing" to make knowledge creation easier
关于短视频平台框架搭建与技术选型探讨
Take you to travel in space, and American photography technology provides comprehensive technical support for aerospace creative applet
SDC intelligent communication patrol management system of Nanfang investment building
PyTorch 22. Pytorch common code snippet collection
字节跳动2020秋招编程题:根据工号快速找到自己的排名
通用型冒泡、选择、插入、希尔、快速排序的代码实现
H5案例开发