当前位置:网站首页>The difference between null and undefined
The difference between null and undefined
2022-07-28 05:51:00 【Still love me】
Java Object Class is the parent of all classes , in other words Java All classes of inherit Object, Subclasses can use Object All the ways .
null and undefined The difference between
1、 First, the data types are different
console.log(typeof null) //object
console.log(typeof undefined) //undefined
2、null and undefined Both equal , But when the two make a congruent comparison , The two are not equal .( Because their data types are different )
console.log(null==undefined) //ture
console.log(null===undefined) //false
3、 Converted to different numbers
console.log(Number(null)) //0
console.log(Number(undefined)) //NaN
console.log(Number(22+null)) //22
console.log(Number(22+undefined)) //NaN
4、null representative “ empty ”, For null pointer ;undefined Is defined without assignment
var a;
console.log(a);//undefined
var b=null;
console.log(b);//null
边栏推荐
猜你喜欢
随机推荐
JS中的!!
标准C语言总结4
基于php小区疫情出入管理系统(php毕业设计)
树莓派蓝牙调试过程
HDU-1284:钱币兑换问题 推理+动态规划(dp)
对极大似然估计、梯度下降、线性回归、逻辑回归的理解
DOM基础
es6新增--->对象(Object)
标准C语言学习总结7
基于Easy CHM和VS的帮助文档制作
softmax多分类 梯度推导
树莓派WIFI一键连接配置
Sorting out problems related to ArcMap join table
Canvas绘图1
Set scroll bar
C语言推箱子
简单几步实现小程序分享朋友圈
分支与循环语句
结果填空 国庆有几天是星期日(纯Excel解决)
C语言回顾(修饰词篇)









