From the Competa IT archive; first published on 21–12–2017 by Raymon.

Well, I can make a very long description about how to check if an object is empty, but this could be very short!

function isEmptyObject(objectInput) {
for ( name in objectInput) {
return false;
return true;

Simply, if the for-in loop is finding any property, it will start to iterate over the first property, but after this it will return false. But when it won’t loop it directly returns true.

Nothing difficult! But a very handy util function to use in if-else statements.



Competa IT

Dutch agency for software development professionals — join us!