出现场景
image.png二者不同
undefined == null//true
undefined === null//false
Number(null)//0
5+null//5
Number(undefined)//NaN
5+undefined//NaN
思考
为何要有null,还要用undefined?
undefined == null//true
undefined === null//false
Number(null)//0
5+null//5
Number(undefined)//NaN
5+undefined//NaN
为何要有null,还要用undefined?
本文标题:undefined & null
本文链接:https://www.haomeiwen.com/subject/qfqarxtx.html
网友评论