How to check if object is empty in JavaScript

DOM
By Jad Joubran · 
Last updated Feb 27, 2024
const obj = {};

const isEmpty = Object.keys(obj).length === 0;
true
Object.keys on MDN