For example, how do I know that the myObject object literal contains two items?
var myObject = {
item1 : "blablabla",
item2 : "blablabla
};
For example, how do I know that the myObject object literal contains two items?
var myObject = {
item1 : "blablabla",
item2 : "blablabla
};
If you didn't override the prototypes of myObject
,
var count = 0;
for (var k in myObject) ++ count;
return count;
Otherwise, see the answer haim's link.