JS判断对象是否为空

let obj1 = {};
let obj2
= {user: '小明', age: 26};
console.log(JSON.stringify(obj1)
== '{}'); // true
console.log(JSON.stringify(obj2) == '{}'); // false

 

posted @ 2020-05-10 15:36  徐林俊  阅读(670)  评论(0编辑  收藏  举报