Js如何判断undefined和null
生活随笔
收集整理的這篇文章主要介紹了
Js如何判断undefined和null
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
判斷是否為undefined
var example = undefined; if (typeof(example) == "undefined") {console.log("undefined") }判斷是否為null
var example = null; if (!example && typeof(example)!='undefined' && example!=0) {console.log("null"); }總結
以上是生活随笔為你收集整理的Js如何判断undefined和null的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 轻油是什么油 轻油简单介绍
- 下一篇: uni-app打包h5