s

javascript check if an object is empty edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 16 March 2021 | 1418

how to check in javascript if an object is empty

Solution

obj && Object.keys(obj).length === 0 && obj.constructor === Object