1.空對象的判斷spa
let obj={}; Object.keys(obj).length ==0 //爲空
2.對象爲null的判斷code
let obj=null;if (!obj&& typeof (obj) != "undefined" && obj!= 0) { console.log('obj爲null') }