Home > Web Front-end > JS Tutorial > How to determine if the page object is empty in JS

How to determine if the page object is empty in JS

小云云
Release: 2018-03-15 16:05:23
Original
2345 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:
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
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template