About MePublicationsContact

Fastest way to check if an object is empty

By Suresh Kumar Mukhiya
Published in Frontend Cheetseat
October 27, 2021
1 min read


Given an object, the aim is to check weather the object is empty or not.


const data = {}

Expected Output:

isObjectEmpty({}) => TRUE
isObjectEmpty({a: 1}) => FALSE


Note, there are several ways to check weather an object is EMPTY or not. The solution given below is one of the fastest way to check it.

Check benchmarking here: https://tomekkolasa.com/how-to-check-if-object-is-empty-in-javascript.

 * There is one of the fastest way to check if an object is Empty

export const isObjectEmpty = (myObject = {}): boolean => {
  for (const prop in myObject) {
    if (Object.prototype.hasOwnProperty.call(myObject, prop)) {
      return false
  return true


Previous Article
Concatenate array of objects inside an array of objects
Suresh Kumar Mukhiya

Suresh Kumar Mukhiya

Software Engineer


Artificial Intelligence
Frontend Cheetseat
My Philosophy
Paper Review
Research Methods
Software Architecture

Related Posts

Insert Property and values at specific position in an Object in JavaScript
December 26, 2021
1 min
© 2022, All Rights Reserved.

Quick Links

PublicationsAbout meContact Me

Social Media