var attr, len = 0;
for (attr in obj)len++;
var count = 0;
for (k in myobj) if (myobj.hasOwnProperty(k)) count++;
Object.keys(obj).length
Object.getOwnPropertyNames(obj).length
@reference_1_stackoverflow
@reference_2_stackoverflow
@reference_3_blueidea
@reference_4_oschina
@reference_5_mozilla
@reference_6_taocms
No comments:
Post a Comment