Detects whether an object is an empty object (pick)

Source: Internet
Author: User

/*    * 检测对象是否是空对象(不包含任何可读属性)。 //如你上面的那个对象就是不含任何可读属性   * 方法只既检测对象本身的属性,不检测从原型继承的属性。    */ function isOwnEmpty(obj)       for ( var name  in obj)                if (obj.hasOwnProperty(name))                        return false                    return true };  /*    * 检测对象是否是空对象(不包含任何可读属性)。    * 方法既检测对象本身的属性,也检测从原型继承的属性(因此没有使hasOwnProperty)。    */ function isEmpty(obj)       for ( var name  in obj)                 return false           return true }; 

Detects whether an object is an empty object (pick)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.