let stopArray = false
const res2 = arrOne.reduce((acc, cur, idx, def) => {
const findCity = arrTwo.filter(el => !def.find(it => it.city === el.city))
if(findCity && findCity.length > 0 && !stopArray){
stopArray = true
return [...acc, ...findCity, cur]
}
return [...acc, cur]
}, [])
console.log('2', res2)
|