/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Object.prototype.count = function() { c = 0;for(i in this){if (this.hasOwnProperty(i)){c++;}};return c; } MyObject = { a : '0', b : '1', c : '2' } alert(MyObject.count())
Comments
