Return to Snippet

Revision: 44515
at April 13, 2011 03:08 by root_hacker


Initial Code
Object.prototype.size = function() {
    var size = 0, key;
    for (key in this) {
        if (this.hasOwnProperty(key)) size++;
    }
    return size;
};

Initial URL

                                

Initial Description
if you need ecmascript 5 functions then use underscore.js

Initial Title
javascript: get length of an object's children

Initial Tags
javascript

Initial Language
JavaScript