const items = [{ price: 250 }, { price: -150 }, { price: 150 }, { price: 500 }];
let result = items.map(({ price }) => price);
console.log(result);
Is it possible to somehow embed a check in this place - items.map(({ price }) => price); - to check for a negative value, or do I need to do it again, map ?
UPD: I want to get summ of all numbers, except negative