var obj1 = {};
var obj2 = {age:22};
方法一:
function JSON_Stringify(obj){
if(JSON.Stringify(obj) == '{}'){
return !1;
}else{
return !0;
}
}
方法二:
function traverse(obj){
for(var i in obj){
return !0;
}
return !1;
}
方法三:ES6新增的方法Object.keys():
function ES6_new(obj){
if(Object.keys(obj).length == 0){
return !1;
}else{
return !0;
}
}