C
Christoph Boget
If I had an array like so:
var bob = ['this', 'that', 'other'];
I can find out the size of the array by doing
bob.length;
Is there a comparable way to get the size of an object? So if I did:
var bob = { 'this': 1, 'that' : 2, 'other': 3 };
I could do something to find out that the "size" of the object is 3 -- the
number of properties the object has? I know I can do this:
var cnt = 0;
for( var i in bob ) {
cnt++;
}
but there's got to be a better/easier way? Or isn't there and I should just
prototype the base Object class?
thnx,
Christoph
var bob = ['this', 'that', 'other'];
I can find out the size of the array by doing
bob.length;
Is there a comparable way to get the size of an object? So if I did:
var bob = { 'this': 1, 'that' : 2, 'other': 3 };
I could do something to find out that the "size" of the object is 3 -- the
number of properties the object has? I know I can do this:
var cnt = 0;
for( var i in bob ) {
cnt++;
}
but there's got to be a better/easier way? Or isn't there and I should just
prototype the base Object class?
thnx,
Christoph