let objValue = {} console.log(JSON.stringify(objValue)==='{}') let result = function (obj) { for (let key in obj) { return false;//如果不为空,可遍历,返回 false } return true; } console.log(result(objValue));//返回true console.log(Object.keys(objValue).length == 0);//返回true