Skip to content

Instantly share code, notes, and snippets.

View scottopolis's full-sized avatar

Scott Bolinger scottopolis

View GitHub Profile
@scottopolis
scottopolis / splice-object-array.js
Last active January 31, 2023 06:54
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 );