Home > Web Front-end > JS Tutorial > body text

How to determine if the page object is empty in JS

小云云
Release: 2018-03-15 16:05:23
Original
2268 people have browsed it

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}
Copy after login

The second type:

function isEmptyObject(e) 
{
    if(Object.keys(e).length === 0)       
         return true;            
          return false;}
Copy after login

The third type:

function isEmptyObject(e) 
{
     if(Object.getOwnPropertyNames(object).length ===0)
         return true; 
     return false;}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template