js常用到的方法积累

//获取对象长度的方法
function countObjLen(obj) {
     var count = 0;
     for (var property in obj) {
         if (Object.prototype.hasOwnProperty.call(obj, property)) {
                count++;
         }
     }
     return count;
}

 

posted @ 2017-07-03 15:51  CodeProducter  阅读(155)  评论(0)    收藏  举报