I need to check my java object value is empty or not. And I need to check this one by one.
I crate my code to do this task…But I can’t check values one by one. If all of my object value is empty, my code is working…But it can’t check values one by one.
const coverDesc = action.data.coverDescriptionLocalization;
Methord 01- :-
if (Object.values(coverDesc ).every((x) => x === null || x === '')) {
console.log('Empty');
} else {
console.log('Not empty');
}
Methord 02- :-
for (const key in coverDesc) {
if (coverDesc.hasOwnProperty(key)) {
if (Object.values(coverDesc[key]).every((x) => x === null || x === '')) {
console.log('Empty');
} else {
console.log('Not empty');
}
}
}