const myArray = [{
id: 1,
cost: 200
}, {
id: 2,
cost: 1000
}, {
id: 3,
cost: 50
}, {
id: 4,
cost: 500
}]
const min = Math.min(...myArray.map(item => item.cost))
const max = Math.max(...myArray.map(item => item.cost));
console.log(min);
console.log(max);