Всем привет мне нужно объединить два массива с уникальными значениями у меня получилось но то гавно код я думаю можно сделать проще
const arrOne = [
        {city: '111', price: 1},
        {city: '222', price: 2},
    ]
    const arrTwo = [
        {city: '111', price: 0},
        {city: '333', price: 0},
        {city: '444', price: 0},
    ]
    const res = arrOne.reduce((acc, cur, idx, def) => {
        const findCity = arrTwo.filter(el =>  !def.find(it => it.city  === el.city) )
        console.log('findCity', findCity)
        if(findCity && findCity.length > 0){
            return [...acc, ...findCity, cur]
        }
        return [...acc, cur]
    }, [])
   console.log('res', [...new Set(res)]  )