const arr = [{id: 1, name: '123', price: 11, discount: 0, quantity: 1, total: 1}, {id: 2, name: '123', price: 11, discount: 0, quantity: 1, total: 1}];
const productsValidation = (data) => data.every(
({ id, name, price, discount, quantity, total }) =>
id && name && price && discount && quantity && total
);
console.log(productsValidation(arr));
I want to check if the objects in the array contain the values I expect, but for some reason every returns false. Why?