how to check if any object has its key or value as empty strings? code example
Example 1: javascript check if object is empty
function isObjectEmpty(obj) {
return Object.keys(obj).length === 0;
}
Example 2: check undefined object javascript one liner set to emtpy
const isEmpty = Object.values(object).every(x => (x === null || x === ''));
Example 3: check undefined object javascript one liner set to emtpy
console.log(myVar == null ? myVar.myProp : 'fallBackValue');