isEmpty()-检查对象是否为空

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了isEmpty()-检查对象是否为空相关的知识,希望对你有一定的参考价值。

Use this function to test whether or not a javascript object is empty.
  1. function isEmpty(obj) {
  2. for(var prop in obj) {
  3. if(obj.hasOwnProperty(prop))
  4. return false;
  5. }
  6. return true;
  7. }

以上是关于isEmpty()-检查对象是否为空的主要内容,如果未能解决你的问题,请参考以下文章