Skip to content

Instantly share code, notes, and snippets.

@ladypython247
ladypython247 / splice-object-array.js
Created October 8, 2022 13:46 — forked from scottopolis/splice-object-array.js
Remove object from array of objects in Javascript
// we have an array of objects, we want to remove one object using only the id property
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id of 37
const removeIndex = apps.findIndex( item => item.id === 37 );
// remove object
apps.splice( removeIndex, 1 );