Possible Duplicate:
is object empty?
So let's var someObject = { };
how can i detect that object hasnt any properties and methods?
Possible Duplicate:
is object empty?
So let's var someObject = { };
how can i detect that object hasnt any properties and methods?
function isEmpty(ob){
for(var i in ob){ return false; }
return true;
}
isEmpty({a:1}) // false
isEmpty({}) // true