[JavaScript] JavaScript获得指定对象的大小 →→→→→进入此内容的聊天室

来自 , 2019-11-15, 写在 JavaScript, 查看 151 次.
URL http://www.code666.cn/view/ea1818cb
  1. function objectSize(the_object) {
  2.   /* function to validate the existence of each key in the object to get the number of valid keys. */
  3.   var object_size = 0;
  4.   for (key in the_object){
  5.     if (the_object.hasOwnProperty(key)) {
  6.       object_size++;
  7.     }
  8.   }
  9.   return object_size;
  10. }
  11.  
  12.  
  13. //javascript/4141

回复 "JavaScript获得指定对象的大小"

这儿你可以回复上面这条便签

captcha