var foo = {"key1": "value1", "key2": "value2", "key3": "value3"};
Object.prototype.foobie = 'bletch'; // add property to foo that won't be counted
var count = 0;
for (var k in foo) {
if (foo.hasOwnProperty(k)) {
++count;
}
}
alert("Found " + count + " properties specific to foo");