How to check if a Object is empty with Vanilla JavaScript

- Javascript

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 👍

Latest posts

What is the JavaScript Set in ES2015 and when should you use it?

The ES2015 spec is full of new features that continuously be introduced in all the new browsers. The Set collection is one of those new things.

My first thought was, well I could just use a normal Array! But I will show you what you can do with the Set collection.