let obj = {};
console.log(JSON.stringify(obj) === "{}");
//返回true
console.log(Object.keys(obj).length);//0
JS 判断空对象
最新推荐文章于 2024-07-01 00:30:00 发布
let obj = {};
console.log(JSON.stringify(obj) === "{}");
//返回true
console.log(Object.keys(obj).length);//0