In order to determine whether an object is empty, we use Object.keys()
along with the length
method and do the following:
const a = {};
console.log(Object.keys(a).length); //0
Published by Muhammad Asfour
Estimated reading time: 1 min
In order to determine whether an object is empty, we use Object.keys()
along with the length
method and do the following:
const a = {};
console.log(Object.keys(a).length); //0