I have this array of object:
var arr = [
{ value : 'title', text : '' },
{ value : 'product', text : '' },
{ value : 'price', text : '' },
{ value : 'number', text : '' },
];
var error = false;
Now, I want to loop through this arr array of object and check if only one property (text) is NOT empty. If so then stop the loop and set the error variable to false otherwise true;
I am trying this code:
arr.every((item)=>{
if (Object.values(item).includes(null)) {
error = true;
} else {
error = false;
}
});
but not working according to my expectation :(