Last active
June 19, 2020 14:15
-
-
Save geomago/6b7ed81c0b618773c947f0ec73a5e2b2 to your computer and use it in GitHub Desktop.
merge_arrays_2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let allCars = cars2.reduce( | |
(result,item) => { | |
if ( cars.findIndex( car => car.id == item.id ) < 0) { | |
result.push(item); | |
} | |
return result; | |
}, | |
cars.slice(0) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment