当前位置:网站首页>null和undefined的区别
null和undefined的区别
2022-07-28 05:20:00 【依然爱我】
Java Object 类是所有类的父类,也就是说 Java 的所有类都继承了 Object,子类可以使用 Object 的所有方法。
null和undefined的区别
1、首先是数据类型不一样
console.log(typeof null) //object
console.log(typeof undefined) //undefined
2、null和undefined两者相等,但是当两者做全等比较时,两者又不等。(因为他们的数据类型不一样)
console.log(null==undefined) //ture
console.log(null===undefined) //false
3、转化成数字不同
console.log(Number(null)) //0
console.log(Number(undefined)) //NaN
console.log(Number(22+null)) //22
console.log(Number(22+undefined)) //NaN
4、null代表“空”,代表空指针;undefined是定义了没有赋值
var a;
console.log(a);//undefined
var b=null;
console.log(b);//null
边栏推荐
- Some problems of ArcGIS Engine Installation
- Making E-R diagram based on XMIND
- Review of metallurgical physical chemistry --- electrodeposition and reduction process of metals
- C语言走迷宫
- 树莓派蓝牙调试过程
- Zotero - a document management tool
- CAD-GIS数据转换
- Microsoft edge browser plug-in (2)
- 异步编程Promise
- Review of metallurgical physical chemistry ---- gas solid reaction kinetics
猜你喜欢

Merge two ordered arrays of order table OJ

MYSQL之搭建数据库系列(一)——下载MYSQL

Centos7 install MySQL 5.7

Arcgis Engine安装的若干问题

书籍-乌合之众

ArcGIS Engine开发资源

ArcMap map map projection related operations

Review of metallurgical physical chemistry -- Fundamentals of chemical reaction kinetics

Competition arrangement in GIS field (incomplete statistics)

DOM基础
随机推荐
书籍-聪明的投资者
uniapp问题:“navigationBarTextStyle“报错:Invalid prop: custom validator check failed for prop “navigat
ES6----解构赋值
Interface idempotency problem
五子棋优化版
Oracle create table, delete table, modify table (add field, modify field, delete field) statement summary
函数基础知识以及特殊点
c语言:通过一个例子来认识函数栈帧的创建和销毁讲解
Annotation and grid addition of ArcGIS map making
结果填空 马虎的算式(暴力解决)
wangeditor(@4.7.15)-轻量级的富文本编辑器
DOM基础
操作文档树
分支与循环语句
Example of MySQL processing legacy data
Review of metallurgical physical chemistry -- rate equations of complex reactions
js-简单的发布订阅类
使用sourcetree推送仓库时 Failed to connect to www.google.com port 80: Timed out
结果填空 啤酒和饮料
蓝桥代码 翻硬币(我这样写也通过了,官网测试是不是有问题)