## I need to replace objects in arr1 with items from arr2 with same id
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
// Remove object
apps.splice(removeIndex, 1);
Last active
August 12, 2021 22:12
-
-
Save mknparreira/ab8287ce97a517827a63dfe07f3070ca to your computer and use it in GitHub Desktop.
Javascript | If you want to remove one object using only the id property
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/scottopolis/6e35cf0d53bae81e6161662e6374da04
http://stackoverflow.com/questions/16491758/remove-objects-from-array-by-object-property