Is empty object (v2)

Revision 2 of this benchmark created on


Setup

let a = {
          "icon": {
          },
          "font": {
          },
          "background": {
          },
          "border": {
          },
          "borderRadius": {
          }
        
      };
function isEmptyObject(object ) {
  for (const key in object) {
    if (Object.prototype.hasOwnProperty.call(object, key)) {
      return false;
    }
  }

  return true;
}

Test runner

Ready to run.

Testing in
TestOps/sec
Object.keys
let c = Object.keys(a).length > 0;
ready
for .. in
let c = isEmptyObject(a);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.