How to check if a Object is empty with Vanilla JavaScript

In need of a positive encouragment?

Go to Positivity By Ray Ray and grow a positive mindset! ❤️

Well I can make a very long description about how to check if a 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 very handy util function to use in if-else statements 👍