How to check if the Object is empty?
1 min readJul 26, 2020
Although there are multiple ways of checking an object is null, here are the different ways of how we can check if an object is Empty.
first, let us create an object.
const empty = { }
1) The first way and older technique
using loadash : )
_.isEmpty(empty); // true
2) The second way and the Newer technique
Using the default Object properties:
Object.keys(empty).length === 0 && empty.constructor === Object //true
Do you have any other ways of checking? let me know in the comments:)
#EnjoyProgramming