I try to merge two arrays:
productsAll = parserArrayFull.map((item) => {
return {
...item,
...firestoreArrayFull.find((y) => y.productSKU === item.SELLER_SKU),
};
});
Everything works OK if in "firestoreArrayFull" there is "productSKU" with the same value like item.SELLER_SKU. But if not there is error "Cannot read property 'productSKU' of undefined" How to make condition for this situation? I would like to keep "item" only in the case of error. regards