This article mainly shares with you how JS determines that the page object is empty. We have shared three methods with you, hoping to help you.
The first type:
function isEmptyObject(e) { var t; for (t in e) return !1; return !0}
The second type:
function isEmptyObject(e) { if(Object.keys(e).length === 0) return true; return false;}
The third type:
function isEmptyObject(e) { if(Object.getOwnPropertyNames(object).length ===0) return true; return false;}
Related recommendations:
JS/Jquery method to determine if an object is empty_javascript skills
The above is the detailed content of How to determine if the page object is empty in JS. For more information, please follow other related articles on the PHP Chinese website!